Skip to content

Support jest cli options when using @angular-devkit/build-angular:jest #25668

@rafagsiqueira

Description

@rafagsiqueira

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:

{
  "configurations": [
    {
      "type": "node",
      "name": "vscode-jest-tests.v2",
      "request": "launch",
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "cwd": "${workspaceFolder}",
      "runtimeExecutable": "ng",
      "args": [
        "test",
        "etips-utils",
        "--run-in-band",
        "--watch-all=false",
        "--test-name-pattern",
        "${jest.testNamePattern}",
        "--test-path-pattern",
        "${jest.testFile}"
      ]
    }
  ]
}

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions