-
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
fix(testing): issue passing coverageRepoters commandline #2645
Conversation
In Jest coverageReporters are an array of strings (https://jestjs.io/docs/en/configuration#coveragereporters-arraystring). In here it is an optional string. When passing a string value for the coverageReporters to the command line, it results into the following error: Failed to write coverage reports: ERROR: TypeError: coverageReporters.forEach is not a function STACK: TypeError: coverageReporters.forEach is not a function
Thank you so much for your PR! I'm not sure if the fix is right. |
You are correct, but didn't want to change the current contract, because I'm not sure if it would break with other testing frameworks. I think the angular cli only allows one reporter. If it is Ok for you I can change it. |
Sorry for the late reply, folks. I'm a bit confused about the current state. You are saying that currently the coverageReporters option cannot be used, right? It only accepts a string, and Jest expect an array. Is this the case in Nx 9.3? |
It still seems to be a single string nx/packages/jest/src/builders/jest/schema.json Lines 119 to 122 in b5025ef
|
738e12c
to
d1679ce
Compare
I'm really sorry folks for the late reply. I think we should change the schema to accept an array of string instead of wrapping the provided value into an array. "coverageReporters": { With this change, we will be able to do: nx test myproj --coverageReporters=json,text |
@vsavkin that should be the best solution :). But I wasn't sure that it would conflict with the schema of the angular-cli. That is why I solved it this way. |
Changing the schema of the jest builder won't affect or by affected by the Angular CLI. We aren't wrapping an existing builder, so we can come up with any schema we want. |
@kristofdegrave, please let me know if you need any help with this. I know I haven't been the quickest communicator here, so if you don't have time to finish it up, it's totally OK. I can do it in this case, but I'll keep you as a commit author. |
Sorry folks, but I'm going to close this PR. I'm trying to keep the PR list short to reflect the things that are currently being worked on |
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
In Jest coverageReporters are an array of strings (https://jestjs.io/docs/en/configuration#coveragereporters-arraystring). In here it is an optional string.
Current Behavior (This is the behavior we have today, before the PR is merged)
When passing a string value for the coverageReporters to the command line, it results into the following error:
Failed to write coverage reports:
ERROR: TypeError: coverageReporters.forEach is not a function
STACK: TypeError: coverageReporters.forEach is not a function
Expected Behavior (This is the new behavior we can expect after the PR is merged)
Use the provided coverageReporter
Issue