Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests Won't Run on Node 20.11 #28

Open
Olliebrown opened this issue Feb 29, 2024 · 0 comments
Open

Tests Won't Run on Node 20.11 #28

Olliebrown opened this issue Feb 29, 2024 · 0 comments

Comments

@Olliebrown
Copy link

Expected Behavior

Tests should be able to run by executing the npm run test command

Observed Behavior

The tests fail with the error

  Uncaught exception in test/usps.ts

  TypeError {
    code: 'ERR_UNKNOWN_FILE_EXTENSION',
    message: 'Unknown file extension ".ts" for /usps-webtools-promise/test/usps.ts',
  }

This error repeats for all files.

Details

I was trying to author a pull-request that will add the newly required 'password' field to all interfaces but when I tried to run the tests they all failed. This seems to be due to new module loading standards in node 20 where it is unwilling to execute .ts files even when specifying --loader=tsx/esm. The TSX documentation mentions that it may need to change to --import=tsx/esm and while this change does cause it to report the error differently, the same error remains. I tried a bunch of different variations on this in the ava settings inside the package.json but could not find a workaround.

In the meanwhile, I might try installing node 18 to see if it still runs okay there, but it would be nice to be able to run the tests on the latest node LTS version.

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

No branches or pull requests

1 participant