Skip to content

fix: make generated TypeScript ESM tests cross-platform - #919

Open
GhaythBenAbid wants to merge 1 commit into
fastify:mainfrom
GhaythBenAbid:fix/windows-ts-esm-test-command
Open

GhaythBenAbid wants to merge 1 commit into
fastify:mainfrom
GhaythBenAbid:fix/windows-ts-esm-test-command

Conversation

@GhaythBenAbid

Copy link
Copy Markdown

Fixes #835

The generated TypeScript ESM test command currently uses POSIX inline environment-variable syntax, which fails in Windows Command Prompt. It also uses the deprecated Node loader flag.

This change adds a small preload module that sets FASTIFY_AUTOLOAD_TYPESCRIPT and registers ts-node through node:module. The generated test script loads it with the cross-platform --import option.

The ESM generator test now exercises the actual app-ts-esm template, including the preload module.

Verification:

  • ESLint passes for the changed files
  • Focused TypeScript and TypeScript ESM generator tests pass
  • unit:cli-js passes: 229 passed, 3 skipped
  • Generated TypeScript ESM test runner passes: 4 passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generated Fastify ESM/TS app has broken npm test command (FASTIFY_AUTOLOAD_TYPESCRIPT)

1 participant