-
-
Notifications
You must be signed in to change notification settings - Fork 271
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
Add --ts flag to properly support projects with mixed .js and .ts files. #550
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious why we can't just detect the double-instrumentation and prevent it? The problem seems like it arises when you have something like this:
// load-ts.js
require('./ok.ts')
// ok.ts
import * as t from './'
t.pass('this is fine')
node -r ts-node/register -r ts-node/register load-ts.js
But when I run that, it seems like it works fine, so I'm a little bit confused about whether I understand the problem this is trying to address. Do you have an example where I can reproduce the problem you're experiencing?
Also: note that this PR is to the master branch, which is version 13. To address the issue in a v12 legacy release, it'll have to be done (a little bit differently) in the v12
branch. Maybe not an issue you care about if you want to upgrade anyway, but worth mentioning.
@@ -544,11 +544,15 @@ Much more documentation available at: https://www.node-tap.org/ | |||
}), | |||
|
|||
esm: flag({ | |||
default: process.env.TAP_NO_ESM !== '1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unrelated?
Oh! Maybe what you're describing only happens when there are two different instances of ts-node in play? I copied ts-node to another folder, and ran it this way. This is an interesting problem:
|
Interestingly, if I do what the error message says, and |
It seems like a cleaner way to address this would be to treat {
"tap": {
"ts": false,
"test-arg": [
"-r",
"my-ts-node/register"
]
}
} Would that address the problem? |
Properly addresses issues #549 and #526