-
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
Generate complete jest config for angular libraries #2803
Comments
As members of the project are being silent, I would just recommend going with PR 😉 |
This might help with #2344. We're having a difficult time running jest tests consistently in both the IDE and CLI due to the fact that most jest IDE runners can only look at a single |
I managed to write root level jest.config, that supports both. https://gist.github.com/jeserkin/2e417326418cde2b06bd97dbb79a3ec2 But Debugging with use of breakpoints is not working for me in IDE and I am not sure if it is related to jest setup or not. @wrslatz if you need to run tests for both your app and your project libs, then easiest wat, that I found was to just make a custom script in package.json and that is it.
|
@jeserkin I saw your config on one of those other issues, definitely an improvement! We are getting around it right now by
This works, but is less than optimal for the following reasons:
tl;dr it works but we lose some of the benefits of Nx along the way, making for a poorer experience |
@wrslatz @jeserkin I just wanted to add the solution we are using to run tests using VSCode-Jest. This issue is somewhat of a requirement for it though (at least without touching generated libs), as all libs must have a working jest config. I've uploaded the script on gist: https://gist.github.com/FERNman/14e3fe4086d6040cbb1f8e6174c9f0c6 What it does is pretty much a simplified version of Also, it may require maintenance from time to time if the nx workspace interface changes, but that should not happen too often. |
Thanks @FERNman for passing this along! I'll give it a shot |
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
We are still experiencing this issue in our Nx monorepo |
Sorry. The issue was marked by mistake. I removed the label. |
@vsavkin no worries, I saw the new stale automation got put in place so figured it's related. My comment was simply to bump the discussion. |
May I ask what is next? I can have this file in root, but I am not sure how to use it |
Compile the script and set the |
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
Is this issue still valid? I think this has been addressed in recent Nx versions |
For us it's been resolved with the new |
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. |
Expected Behavior
When generating a new angular library, a complete
jest.config.js
file should be generated, including everything needed for jest-preset-angular.This would allow using the jest CLI directly which has a few benefits:
Current Behavior
The
jest.config.js
does not include all necessary config properties required to run the tests. Instead, those are patched by the nx jest builder, preventing configuration by the user.Steps to Reproduce
cd <path_to_library_root> && jest
)Solution
I would solve this by renaming
skipSerializers
to something likeuseAngularPreset
, controlling all required properties forjest-preset-angular
.I'm happy to do a PR for this if that's the way to go.
Related
#2768
#2377
#2314
#1506
#1091
The text was updated successfully, but these errors were encountered: