Expose jest configuration file on project generation #931
Labels
kind: feature
New feature or request
problem: stale
Issue has not been responded to in some time
scope: integration
Related to an integration, not necessarily to core (but could influence core)
solution: duplicate
This issue or pull request already exists
Current Behavior
The default jest configuration is generated by a function at test runtime, and the user can specify an override, which is merged into the hidden default config
Suggested Solution
The jest configuration should just be generated into the root of the project. Probably the eslint config as well, but that doesn't have functionality issues like this one (see below).
Who does this impact? Who is this for?
Requiring merging configs has no benefits to the developer. If you ever need to change something, it usually results in having to write convoluted nested spreads, or pushing onto internal arrays of things. It's very confusing to understand what the final config is when this happens. If the user doesn't need to modify the config, the presence of the file does him no harm. The downside is that tsdx cannot update default options in existing projects, but a jest config is much less complex than something like a webpack config where that would be a major downside.
The larger reason this is useful is because IDEs such as Webstorm read the config file to understand how to run the IDE jest tooling. With the current configuration, Jetbrains IDEs cannot run the tests of tsdx projects because it doesn't know about the
transforms
option and so won't use ts-jest when necessary. If this feature will not be considered, consider instead exposing the jest config as a file and referencing it insidecreateJestConfig
, so that people can at least point to the file inside node_modules.Additional context
For anyone searching for this issue, to fix it you must define
jest.config.js
file with this in it:You then must also add
ts-jest
andbabel-jest
to your package.json and tell Webstorm to use that config file in your run configurations, if it does not use it by default.The text was updated successfully, but these errors were encountered: