-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
Support TypeScript extensions when using --test
flag.
#257
Comments
Happy to accept a PR to add support. IIRC there isn't an API to extend this. I recommend starting by opening a feature request with Node.js. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This issue is for implementing a feature, and these workarounds aren't productive towards that goal so I'm going to hide them. For anyone encountering this problem: We're looking for a working approach that actually extends Node.js' Personally, I don't use Node's |
Investigated this. Seems like the Since everything passed into tsx is passed down to Node, you can also pass it into tsx: tsx --test '**/*.test.ts' (Note: quoting the glob prevents your shell from expanding it so Node will expand it instead) The default glob Node uses is here: So we can alter that to support TS extensions for the default behavior with TS support: tsx --test '**/{test,test/**/*,test-*,*[.-_]test}.?(c|m)@(t|j)s' I plan on intercepting the |
Dropped support for Node.js 16 also means |
Thanks for this issue and #410! @remcohaszing am I understanding that you are now (as of tsx --test |
Feature request
Running
node --test
discovers test files. However, it doesn’t discover files that end with the.ts
,.cts
,.mts
, or.tsx
extensions. It would be nice iftsx
supports this.Why?
I would like to leverage the builtin Node test runner. I also like using
tsx
. They work great together, except for this quirk meaning I need to specify all tests as command line parameters.Alternatives
The workaround is to specify test files as command line parameters. This works, but it’s not ideal.
Additional context
https://nodejs.org/api/test.html#test-runner-execution-model
The text was updated successfully, but these errors were encountered: