-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
@nrwl/node library babel jest setting does not work #6782
Comments
Any updates? I am also facing the same error. |
Any help will be appreciated |
Same (kind of) issue after migrating to Angular 13 with:
|
Just came across this myself while doing some internal nx testing. I'll try to take a look at this here soon. Oddly enough running the tests via Webstorm seem to work? (noticed by @nartc) but when running the same test via jest in the command line throws the error. WkMac-NoaQX0xX.1112.mp4 |
looking more into this, you'll need to have {
"presets": [["@nrwl/web/babel", { "useBuiltIns": "usage" }]]
} but it looks like Side Note: this looks to be only with buildable/publishable libraries, as I did not see the issue with only babel-jest enabled when generating a node library. I'll keep looking into this. Edit: |
@WonderPanda @smo043 @the-ult {
"babelrcRoots": ["*"]
} fixes the issue. I'll need to update the generators to make sure they add this file when creating a node library. so summarize, |
Cool, thanks @barbados-clemens for looking into this! I'll this out in the next little bit. Really excited at the possibility of dropping ts-jest, its just so slow |
when creating a jest project with babel-jest a root babel.config.json file will be create if one doesn't exist for allowing jest tests to run successfully ISSUES CLOSED: #6782
when creating a jest project with babel-jest a root babel.config.json file will be create if one doesn't exist for allowing jest tests to run successfully ISSUES CLOSED: #6782
when creating a jest project with babel-jest a root babel.config.json file will be create if one doesn't exist for allowing jest tests to run successfully ISSUES CLOSED: #6782
Running into this while updating to Angular 13 / Nx 13. I tried added that babel config at the root and making sure I have @nrwl/web installed but it doesn't seem to be working still. Was there another step I needed to get around this for now? |
I'm having the same issue. |
@logitimate @valerius21 this issue (and probably the fix cc @barbados-clemens) is targeting |
@nartc Hey, thanks for getting back to us. I am using NX 13 with I got some component libs, which are getting imported with The tests are failing in the apps, not the libraries, but only, when getting used/imported over the I am using the same import syntax in the libs without any issues. Editing the Everything is written in Typescript. |
Turns out adding the However, there is a special config for the test environment: Lines 42 to 43 in cddb1ed
NODE_ENV=test nx test ... Tip: look into |
@markogresak thanks! The error disappears. I am now getting the I'll try to do some config tweaking. |
@valerius21 you’re using ES Modules somewhere. You have to set up mapping or transforms to process the file. Or you can try enabling esmodules (https://jestjs.io/docs/ecmascript-modules), but I’m not sure if the nx setup supports it so there’s a good chance things will break. |
when creating a jest project with babel-jest a root babel.config.json file will be create if one doesn't exist for allowing jest tests to run successfully ISSUES CLOSED: #6782
when creating a jest project with babel-jest a root babel.config.json file will be create if one doesn't exist for allowing jest tests to run successfully ISSUES CLOSED: #6782
when creating a jest project with babel-jest a root babel.config.json file will be create if one doesn't exist and babel deps install for allowing jest tests to run successfully ISSUES CLOSED: #6782
when creating a jest project with babel-jest a root babel.config.json file will be create if one doesn't exist and babel deps install for allowing jest tests to run successfully ISSUES CLOSED: #6782
when creating a jest project with babel-jest a root babel.config.json file will be create if one doesn't exist and babel deps install for allowing jest tests to run successfully ISSUES CLOSED: #6782
when creating a jest project with babel-jest a root babel.config.json file will be create if one doesn't exist and babel deps install for allowing jest tests to run successfully ISSUES CLOSED: #6782
when creating a jest project with babel-jest a root babel.config.json file will be create if one doesn't exist and babel deps install for allowing jest tests to run successfully ISSUES CLOSED: #6782
* fix(testing): create root babel config for babel-jest option when creating a jest project with babel-jest a root babel.config.json file will be create if one doesn't exist and babel deps install for allowing jest tests to run successfully ISSUES CLOSED: #6782 * feat(testing): add migration for missing root babel config
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
After scaffolding a brand new node library using @nrwl/node and selecting the
babelJest
option tests do not run for the generated library.Expected Behavior
Tests should be able to run in a new project
Steps to Reproduce
@nrwl/node
packagebabelJest
option, eg:npm run test babel-test:test
Failure Logs
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.218 s
Environment
The text was updated successfully, but these errors were encountered: