-
Notifications
You must be signed in to change notification settings - Fork 12k
Support jest cli options when using @angular-devkit/build-angular:jest #25668
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
Comments
Thank you for sharing the example and the link to the project. I will consider using the https://github.com/just-jeb/angular-builders project as an alternative. However, I am concerned about the additional configuration required for it to work with Angular and ESM. Best regard, |
I could create a separate issue for "Support debugging jest tests", but I think it's covered by this issue. Today we use the following VS Code launch configuration to debug the current jest test file: {
"name": "Jest current file",
"type": "node",
"request": "launch",
"runtimeArgs": [
"--experimental-vm-modules",
"--inspect-brk",
"${workspaceRoot}/node_modules/jest/bin/jest.js",
"/${fileBasenameNoExtension}",
"--watch",
"--runInBand",
"--testTimeout=10000000" // Prevent timeouts when running in debugger.
//,"--no-cache"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"env": {
"TEST_ENV": "debug",
}
}, I think it's pretty critical to support such a use-case with the Jest builder. There's a case to be made for abstracting this operation into the builder - lmk if you want a separate issue for this. |
Thank you for looking into this. The debugging configurations do work, the problem is when extensions are used which rely on adding runtime parameters to jest. A simple example would be running a single test on a rather long test file. I don’t see how that could be done except adding it.skip to all the other tests on the current file. Extensions dynamically add filters by test name, when tests are ran from the context menu, for example. |
@rafagsiqueira - to run a single test, try replacing But that doesn't discredit this issue, I think there are a lot of use-cases for inserting jest arguments when running tests. |
Allowing Jest CLI options to pass through As for debugging, that's definitely a use case we'll need to support. I have some early ideas about a Duplicate of #25434 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Command
test
Description
Sometimes it might be necessary to provide cli options to jest that are decided at "runtime".
Example below of a debug configuration for running tests in vscode:
Describe the solution you'd like
The project https://github.com/just-jeb/angular-builders implements an approach to allowing jest cli options.
https://github.com/just-jeb/angular-builders/blob/8f00fd9b324d0151f722a4e962fcbeab7891baae/packages/jest/src/index.ts#L37C11-L37C11
Describe alternatives you've considered
Alternative is to use https://github.com/just-jeb/angular-builders, but the build requires a lot more configuration to work with angular and esm.
The text was updated successfully, but these errors were encountered: