1.1 KiB
1.1 KiB
Jest can be configured in many ways, but primarily you'll need to at least have the jestConfig options
"test": {
"executor": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/my-lib/jest.config.ts"
}
}
It is also helpful to have passWithNoTests: true set so your project doesn't fail testing while tests are still being added.
"test": {
"executor": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/my-lib/jest.config.ts",
"passWithNoTests": true
}
}
Snapshots
Update snapshots running with --update-snapshot or -u for short.
nx test my-project -u
Other times you might not want to allow updating snapshots such as in CI. Adding a ci configuration is helpful for adding this behavior.
"test": {
"executor": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/my-lib/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true
}
}
}
nx affected --target=test --configuration=ci
Learn more about affected