Closed jahusa02 closed 8 months ago
With nx Crystals, NX changed the way jest is called. (https://nx.dev/concepts/inferred-tasks)
If you don't have a test target in your project.json but a jest config in the project, nx:run-commands is used as an executor instead of @nx/jest:jest,
project.json
nx:run-commands
@nx/jest:jest
e.g.:
{ outputs: [ '{workspaceRoot}\\coverage\\libs\\shared\\entities' ], executor: 'nx:run-commands', inputs: [ 'default', '^production' ], cache: true, options: { cwd: 'libs/shared/entities', command: 'jest' }, configurations: {} }
Also the options for the testTarget will be different https://github.com/koliveira15/nx-sonarqube/blob/99a070a9122ba7613fc924d65e3314dc3a89b38f/packages/nx-sonarqube/src/executors/scan/utils/utils.ts#L99
the options are:
{ cwd: 'libs/shared/entities', command: 'jest' }
My workaround is to force @nx/jest:jest as the executor in all projects and to configure it under targetDefaults in nx.json like in NX < 18
targetDefaults
nx.json
This issue won't affect old workspaces but definetly new or old ones opting in for nx plugins to infer tasks
With nx Crystals, NX changed the way jest is called. (https://nx.dev/concepts/inferred-tasks)
If you don't have a test target in your
project.json
but a jest config in the project,nx:run-commands
is used as an executor instead of@nx/jest:jest
,e.g.:
Also the options for the testTarget will be different https://github.com/koliveira15/nx-sonarqube/blob/99a070a9122ba7613fc924d65e3314dc3a89b38f/packages/nx-sonarqube/src/executors/scan/utils/utils.ts#L99
the options are:
{ cwd: 'libs/shared/entities', command: 'jest' }
My workaround is to force
@nx/jest:jest
as the executor in all projects and to configure it undertargetDefaults
innx.json
like in NX < 18This issue won't affect old workspaces but definetly new or old ones opting in for nx plugins to infer tasks