-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
How to disable ts-node? #3329
How to disable ts-node? #3329
Comments
The documentation on Customized TypeScript Configuration shows how to override
|
How do we disable Karma's automatic |
Related: #3274 |
I have a |
Cool, I forked Karma, removed the |
The tests in my monorepo magically broke, after a lot of debugging I found out that suddenly karma tests loading my config with ts-node because a dependency of another packages installed ts-node. Is there really no way to turn off this behavior? |
I ended up using this:
|
Just ran into this today. 😓 |
Ping. Karma team, any plan to fix this? |
Looks like PR #3274 stalled. |
This is absolutely ugly/unacceptable behavior. 😡 I'll provide pull request in the future. As a workaround you can use this code in // @ts-nocheck
process[Symbol.for('ts-node.register.instance')]?.enabled(false); |
@maksimr I do agree that this behaviour is causing issues and we should not make such assumptions by default. At the same time we want to allow users to write their configs using their preferred language with the relative convenience. Please see #3521 (comment) for some thinking on the design. But I'm open to discuss alternative/better approach especially if this approach is used by some other popular tool dealing with the same issue. And the PR would be very welcome once the design is discussed and decided! |
Call require('ts-node').register() after checking configFilePath has `.ts` extension Fixes karma-runner#3329
Call require('ts-node').register() after checking configFilePath has `.ts` extension Fixes karma-runner#3329
Call require('ts-node').register() after checking configFilePath has `.ts` extension Fixes #3329
🎉 This issue has been resolved in version 6.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Re-opening as I still want to implement a sustainable solution for this use case. |
Call require('ts-node').register() after checking configFilePath has `.ts` extension Fixes karma-runner#3329
## [6.1.1](karma-runner/karma@v6.1.0...v6.1.1) (2021-02-12) ### Bug Fixes * **config:** check extension before ts-node register ([karma-runner#3651](karma-runner#3651)) ([474f4e1](karma-runner@474f4e1)), closes [karma-runner#3329](karma-runner#3329) * report launcher process error when exit event is not emitted ([karma-runner#3647](karma-runner#3647)) ([7ab86be](karma-runner@7ab86be))
Expected behaviour
ts-node
and don't expect anything to break.Actual behaviour
installing
ts-node
causes previously-working tests to break, because Karma automatically usests-node
, assuming that it is what I want.Environment Details
karma --version
): 4.0.1karma.config.js
file: N/A, there's nothing about ts-node in there.Steps to reproduce the behaviour
Described above.
As soon as I
rm -rf node_modules/ts-node
, errors go away.Errors, for example:
As you can see, tests break simply by installing
ts-node
in the project and not yet converting any tests to TypeScript.I have a
tsconfig.json
file in the project, but used for other things at the moment.It'd be nice to be able to tell Karma which tsconfig to use for test files, and to be able enable TypeScript support manually in the first place, so that there aren't any surprises.
The text was updated successfully, but these errors were encountered: