-
-
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
Preset #6538
Comments
@artola preset should support scoped packages. The fact that Is this the case? |
@ranyitz I do believe that the problem is the non documented constraint that presets need to be named following a convention |
@artola you don't need to name your module specifically. The following will work:
Maybe we can change the description to: "npm module that has For example,
|
We should definitely improve both the docs and the error message in this case |
@SimenB In case we've found a module without
|
|
@SimenB @ranyitz Sorry, may be I did not explain it well. I would like to read our package publised in the scope // jest.config.js
module.exports = {
preset: '@xxx/rdk.jest-preset-proactive'
}; Today it is not possible because of the Jest can manage something as In the meantime we have a workaround: // jest.config.js
module.exports = require('@xxx/rdk.jest-preset-proactive'); This is the reason why I would prefer Node resolution before trying any kind of config lookup. For me makes more sense to extend the use possibilities than just fix the documentation with a constraint. |
@artola If you suggest to start and look for For example, look at |
@ranyitz @SimenB Just a comment, similar situation happens for Babel presets, with same reasoning shown above ... and now it is already in master for Babel 7, for details: babel/babel#8473 Very similar:
I find presets a great tool and we use them for everything (e.g. tslint, webpack, babel, neutrino and jest). |
We don't do anything with the package name, we just have expectations on the name of the file within that module |
@SimenB @ranyitz Thanks a lot for your support. In short:
For my actual use case, I will use option 1. Closing this issue. Thanks again guys. |
@ranyitz I'd still love to see a PR for a better error and some clarifying docs :) |
Please see this issue |
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. |
🐛 Bug Report
Documentations states:
See: https://facebook.github.io/jest/docs/en/configuration#preset-string
Then I would like to use an scope package as follow:
But I got this error:
As I understand the module resolution comes from: https://github.com/facebook/jest/blob/cb87c0a8536519a3ad2f89cfe357a0d2ae99d22c/packages/jest-config/src/normalize.js#L60
where it handles relative packages, but not node resolution.
Workaround:
Expected behavior
Try node resolution first, if it fails proceed with path normalisation.
The text was updated successfully, but these errors were encountered: