fix: restore CI test execution and repair CJS/CLI regressions from dependency bumps - #910
Open
kilisamemarisaaa wants to merge 6 commits into
Open
Conversation
glob v13 removed the callback API: glob(pattern, cb) now returns a promise and the callback never fires, so suite-runner silently ran zero tests and CI stayed green since the glob 11 -> 13 bump (fastify#852). Switch to async/await and fail loudly on glob errors. Co-Authored-By: EvoX <evox@evomap.ai>
Dependabot bumps moved several runtime deps to ESM-only releases that were never exercised because CI ran zero tests: - pkg-up@5 (ESM named exports): require() returned a namespace, breaking `fastify start` with 'pkgUp is not a function' - is-docker@4 (ESM default export): broke `fastify start` the same way - chalk@6 (ESM default export): broke generate/generate-plugin and watch Use named imports / .default interop at each require site. Co-Authored-By: EvoX <evox@evomap.ai>
The util.parseArgs migration (fastify#887) left two breakages that CI never caught because the test suite was silently no-op: - cli.js read argv._ which util.parseArgs values never contains; --help and <cmd> --help crashed with 'Cannot read properties of undefined' - generate-swagger --yaml was rejected by strict mode because yaml was not registered as a known option; register it in args.js (restores the lenient pre-migration behaviour) Co-Authored-By: EvoX <evox@evomap.ai>
…des it
Object.assign(pkg.tstyche || {}, template.tstyche) emitted an empty
'tstyche': {} into generated plugin package.json because the plugin
template has no tstyche section (regression from the tsd -> tstyche
migration, fastify#886). Guard the assignment.
Co-Authored-By: EvoX <evox@evomap.ai>
Under TypeScript 6 the node:test / node:assert types in templates/app-ts(-esm) tests no longer resolve (fastify-tsconfig does not set a 'types' field and @types/node is not picked up automatically), failing compilation with TS2591 — the first time these suites actually ran since CI went hollow. Equivalent CLI flags compile with 7 errors without --types node and 0 with it. Co-Authored-By: EvoX <evox@evomap.ai>
This was referenced Aug 28, 2026
Author
|
CI note on the remaining red job ( |
Pass the ts-node ESM loader only to node:test workers. This avoids Node 26 registering an inherited loader twice while leaving ordinary suites' execArgv untouched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The test suite has been silently running zero tests in CI since
globwas bumped 11 -> 13 (#852, Dec 2025):glob(pattern, cb)no longer accepts a callback (it returns a promise), sosuite-runner.jsnever executed any test file and every CI run stayed green on an empty suite. That hollow green covered five separate regressions introduced by dependency bumps and migrations, all of which this PR fixes.What was broken and why
suite-runner.jsran nothing -glob(pattern, cb)no longer invokes the callback with glob v13. Evidence: CI logs showed every suite completing in about 0.1s with no test output, andc8only reportedsuite-runner.js. Fix: awaitglob(pattern)inside an asyncmain()and fail loudly on errors.ESM-only dependency upgrades broke CommonJS call sites -
pkg-upv5 exposes a namedpkgUpexport, whilechalkv6 andis-dockerv4 expose default exports. Existingrequire()calls received module namespace objects, causingpkgUp is not a function,chalk.x is not a function, and the equivalentisDockerfailure. Fix: select each package's actual export at the existing call sites.CLI parsing broke after the
util.parseArgsmigration (Replace yargs-parser with Node.js built-in util.parseArgs #887) -cli.jsreadargv._, whichutil.parseArgs().valuesnever contains, sofastify --helpandfastify <cmd> --helpthrew while readingsplice;generate-swagger --yamlwas also rejected becauseyamlwas not registered. Fix: read the command fromparsed.positionals[0]and registeryamlinargs.js.fastify generate-pluginemitted an empty"tstyche": {}- assigning intopkg.tstyche || {}when the template had notstychefield created an empty object. Fix: only assign that field when the template provides it.TypeScript 6 could not resolve Node test globals in generated TypeScript suites - the inherited
fastify-tsconfigdoes not declare atypeslist, and the restored suites failed with TS2591 fornode:testandnode:assert. Fix: declare"types": ["node"]in the two ts-node test configs.Node 26 registered the ts-node ESM loader twice in test workers - invoking the JavaScript runner itself with
--loader ts-node/esmallowed the loader to be inherited and registered again bynode:testworkers, producing false TS7006 diagnostics for already-transpiled code. Fix: pass--loader=ts-node/esmonly to TS-ESM workers throughrun({ execArgv }); ordinary suites omit the option and retain their existing inherited arguments.The application-facing regressions in items 2-4 did not reach published versions (7.4.1/8.0.0 still use the earlier dependency set), but they currently break
mainand were hidden by item 1.Verification
npm run lintpasses.npm run all-suites: 12/12 passing across CJS, ESM, TS-CJS, and TS-ESM on Node 22.23.2 / Windows.EBUSYand temporary-directory cleanup chain; they are outside this PR's diff.should-skip-test-suites.jsand skips generated-template suites; the normal CLI suite remains in the CI matrix.Notes