-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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 format configuration file #9636
Comments
Any reactions on this question ? |
I don't think this is worth it. Jest runs on Node and requires your config file using Node. For jest to support Although jest handles transpilation very well thanks to I just haven't seen and can't think of a project that needs a jest configuration so complex that type checking for it becomes necessary. Jest already supports complex scenarios like monorepos very well with relatively simple configurations. The fact that you use and like typescript doesn't mean you have to use it in every single line of code and every file must be a .ts file. |
We've got an issue tracking implementing transforming just about everything possible, but config isn't on there. I think supporting a This should be relatively easily implemented using the standard |
Well the key difference between this and everything else on that list is that the config specifies how to transform everything else. To transform the config itself, we'd have to assume defaults. |
For general transforming totally, but for just TypeScript the configuration is handled by i.e you can do:
There are definitely a few minor caveats and differences, but I think overall it's do-able with minimal effort. |
We had a use case for moving the Jest config to TS as well. We ended up writing a (somewhat hacky) script that uses this feature of jest cli.
If a TS config is passed in, we Using this approach along with babel-register, allows us to write our jest config along with any custom jest runners in TS. The approach looks something like this: https://gist.github.com/brieb/e055e8df36769862bf2907893b3f9a81 Has there been further thought for supporting TS configs?
|
@MarcoScabbiolo I think its worth it, if you you don't consider the narrow scope of TypeScript. Webpack offers the user a choice of language for configuration files. https://webpack.js.org/configuration/configuration-languages/ through the https://www.npmjs.com/package/interpret Doing it this way, allows developers to choose the language they want, to represent the configuration file. As long as they have the proper interpreter registered, the system should automagically just run it. |
I disagree. To me it's a huge win if I can get a fully typed configuration without ever having to look up the documentation for every single option anymore. I'd rather have auto suggestions popping up in my editor than an X ms faster initial execution. |
This brings auto-completion to Jest configuration. See: jestjs/jest#10564 See: jestjs/jest#9636 (comment)
This brings auto-completion to Jest configuration. See: jestjs/jest#10564 See: jestjs/jest#9636 (comment)
* jest.config.ts configuration file in Typescript **Jest** now supports *jest.config.ts* as configuration file. See [https://github.com/facebook/jest/issues/9636](https://github.com/facebook/jest/issues/9636) for more information. * apply only to jest.config.ts Co-authored-by: Roberto Huertas <[email protected]>
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🚀 Feature Proposal
To be able to fully use TypeScript
Motivation
Make the
.js
file not appear in the project.Example
This allows us to TypeScript ONLY.
Expected:
Pitch
Why does this feature belong in the Jest core platform?
Common feature proposals that do not typically make it to core:
Reference
kulshekhar/ts-jest#1415
The text was updated successfully, but these errors were encountered: