-
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
docs: update documentation for using TypeScript configs #3521
Conversation
✅ Build karma 289 completed (commit d073839c2d by @jonkoops) |
✅ Build karma 288 completed (commit d073839c2d by @jonkoops) |
✅ Build karma 290 completed (commit 5a58b2a8cd by @jonkoops) |
✅ Build karma 289 completed (commit ae5fb60400 by @jonkoops) |
✅ Build karma 291 completed (commit 05aa835c0f by @jonkoops) |
✅ Build karma 290 completed (commit 05aa835c0f by @jonkoops) |
✅ Build karma 2687 completed (commit d073839c2d by @jonkoops) |
✅ Build karma 2688 completed (commit ae5fb60400 by @jonkoops) |
✅ Build karma 2689 completed (commit 05aa835c0f by @jonkoops) |
Do you have an example with Ref: #3274 |
The existing documentation was outdated, it is possible to simply use a `.ts` extension for your config file.
✅ Build karma 292 completed (commit 4596bef53a by @jonkoops) |
@devoto13 I've tested this on Node 10 and Node 12 locally both seem to work. In this case I have a specific To be specific this is how we're currently running this code in our project from our NPM scripts: TS_NODE_PROJECT=tsconfig.karma.json karma start Why would the |
✅ Build karma 291 completed (commit 4596bef53a by @jonkoops) |
This is the key difference here. Most of the frontend projects use Your approach is also a valid way to do it, but it will not work on Windows for example and still requires an extra file. So what is the benefit? |
IMO the best solution to this would be to deprecated and eventually remove built-in support for different languages and expose |
✅ Build karma 2690 completed (commit 4596bef53a by @jonkoops) |
In my case I got some errors from including Of course the Since we're going to need to use CommonJS for modules for the forseeable future why not override the This could also be done from the side of the user by passing in compiler options to override: TS_NODE_COMPILER_OPTIONS={ "module": "commonjs" } karma start |
Unfortunately I'm ok updating the documented workaround if you can show a concrete use case, which is impossible with the currently documented approach, but in general we should focus on fixing the root cause instead of improving the workaround for it. You should be able to achieve UPD Or rather passing it to the |
Not even using a tool like
The only use-case that I have here is to avoid using additional files for Karma configuration. We can close this PR if it creates more issues than it solves, although I think it's good for users to be aware of the option. On a side-note I think #3274 actually describes the problem I was running into passing other configuration options.
What is the root cause issue here? I see some people having issues with Karma including |
Again, yes you can solve it. But the idea was to make configuration easier and adding another dependency does not sounds like making things easier.
It should be fine to add this as an alternative approach to configuration customisation section. Something along these lines, alternatively you can customise ts-node behaviour using environment variables (link to the relevant ts-node docs), here is an example. But I don't think we should replace the current docs as env vars approach also has caveats.
Basically Karma automatically runs E.g.
So basically preprocessing of the config is users responsibility and Karma does not have any built-in logic there. Alternative approach was to do something like #2186, but IMO this will complicate current situation even further. |
The above is just an idea, this should be opened as an issue and discussed before starting the implementation. |
Ok, it's clear to me now. I'll go ahead and close this PR for now since it doesn't add much and once the proposed changes are made to load a custom registration it should be resolved anyways. Thanks for taking the time to explain the issue @devoto13. |
The existing documentation was outdated, it is possible to simply use a
.ts
extension for your config file.