Conversation
There was a problem hiding this comment.
Code Review
This pull request extracts and centralizes testing utilities into a new core/test-utils package, updating the handwritten/pubsub package to use it and removing duplicate local files. Feedback on the changes suggests simplifying the shortUUID implementation with slice to avoid unnecessary array allocations, resolving a missing .jsdoc.js configuration file referenced in the docs script, and using recursive wildcards in tsconfig.json to ensure nested files are compiled.
| function shortUUID(): string { | ||
| return crypto.randomUUID().split('-').shift()!; | ||
| } |
There was a problem hiding this comment.
The shortUUID function can be simplified and made more efficient by using slice instead of splitting the UUID string into an array and shifting it. This avoids unnecessary array allocation and the non-null assertion operator.
| function shortUUID(): string { | |
| return crypto.randomUUID().split('-').shift()!; | |
| } | |
| function shortUUID(): string { | |
| return crypto.randomUUID().slice(0, 8); | |
| } |
| "lint": "gts check", | ||
| "prepare": "npm run compile", | ||
| "pretest": "npm run compile", | ||
| "docs": "jsdoc -c .jsdoc.js", |
| "src/*.ts", | ||
| "test/*.ts" |
There was a problem hiding this comment.
After adding the test-utils library, this PR factors it out of the Pub/Sub library so that it's properly shared.
This currently contains the commits of #9229 - once that's merged, this one will get updated.
b/554057686