The v8.0.0 throws an error when using the test helper
import type { FastifyInstance } from 'fastify';
import helper from 'fastify-cli/helper.js';
export function config() {
return {
skipOverride: true,
};
}
export async function build(): Promise<FastifyInstance & AsyncDisposable> {
const argv = [AppPath];
const options = config();
const app: FastifyInstance = await helper.build(argv, options);
await app.ready();
return Object.assign(app, {
[Symbol.asyncDispose]: async () => {
await app.close();
},
});
}
TypeError: argv is not a function
TypeError: argv is not a function
at parseArgs (/home/runner/work/conduit-monorepo/conduit-monorepo/node_modules/.pnpm/fastify-cli@8.0.0/node_modules/fastify-cli/args.js:26:32)
at runFastify (/home/runner/work/conduit-monorepo/conduit-monorepo/node_modules/.pnpm/fastify-cli@8.0.0/node_modules/fastify-cli/start.js:102:16)
at Object.build (/home/runner/work/conduit-monorepo/conduit-monorepo/node_modules/.pnpm/fastify-cli@8.0.0/node_modules/fastify-cli/helper.js:13:12)
at build (/home/runner/work/conduit-monorepo/conduit-monorepo/apps/backend/tests/helper.ts:55:45)
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
at async TestContext. (/home/runner/work/conduit-monorepo/conduit-monorepo/apps/backend/tests/plugins/health-check.test.ts:9:21)
at async Test.run (node:internal/test_runner/test:1125:7)
at async startSubtestAfterBootstrap (node:internal/test_runner/harness:358:3)
Line which throws the error
|
const commandLineArguments = argv(args, { |
Debugging and setting a breakpoint shows that the function is an object rather than a function
My guest is the import causes the error
|
const argv = require('yargs-parser') |
OS info
OS: Linux
Node version: 24.14.0
pnpm: 10.33.4
The v8.0.0 throws an error when using the test helper
TypeError: argv is not a function
TypeError: argv is not a function at parseArgs (/home/runner/work/conduit-monorepo/conduit-monorepo/node_modules/.pnpm/fastify-cli@8.0.0/node_modules/fastify-cli/args.js:26:32) at runFastify (/home/runner/work/conduit-monorepo/conduit-monorepo/node_modules/.pnpm/fastify-cli@8.0.0/node_modules/fastify-cli/start.js:102:16) at Object.build (/home/runner/work/conduit-monorepo/conduit-monorepo/node_modules/.pnpm/fastify-cli@8.0.0/node_modules/fastify-cli/helper.js:13:12) at build (/home/runner/work/conduit-monorepo/conduit-monorepo/apps/backend/tests/helper.ts:55:45) at process.processTicksAndRejections (node:internal/process/task_queues:104:5) at async TestContext. (/home/runner/work/conduit-monorepo/conduit-monorepo/apps/backend/tests/plugins/health-check.test.ts:9:21) at async Test.run (node:internal/test_runner/test:1125:7) at async startSubtestAfterBootstrap (node:internal/test_runner/harness:358:3)Line which throws the error
fastify-cli/args.js
Line 26 in 2877dbc
Debugging and setting a breakpoint shows that the function is an object rather than a function
My guest is the import causes the error
fastify-cli/args.js
Line 3 in 2877dbc
OS info
OS: Linux
Node version: 24.14.0
pnpm: 10.33.4