Skip to content

Commit

Permalink
test(jest): launch only staged files tests when pre commit (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinezanardi committed Aug 13, 2023
1 parent a3b301d commit 8da5e45
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

npx --no-install validate-branch-name;
npm run lint:staged;
npm test;
npm run test:staged;
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ npm run test:e2e:cov
# Run both unit and e2e tests with coverage
npm run test:cov

# Run both unit and e2e tests only on staged files (run on pre-commit)
npm run test:staged

# Run acceptance tests
npm run test:cucumber

Expand Down Expand Up @@ -150,6 +153,9 @@ npm run lint

# Lint and fix
npm run lint:fix

# Lint and fix only on staged files (run on pre-commit)
npm run lint:staged
```

Project is scanned by :
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"lint:staged": "lint-staged -c config/lintstaged/.lintstagedrc.json",
"lint:fix": "eslint . --fix",
"test": "NODE_ENV=test jest --config config/jest/jest-global.ts",
"test:staged": "NODE_ENV=test jest --config config/jest/jest-global.ts -o",
"test:watch": "NODE_ENV=test jest --watch --config config/jest/jest-global.ts",
"test:cov": "NODE_ENV=test jest --coverage --config config/jest/jest-global.ts",
"test:stryker": "NODE_ENV=test rimraf tests/stryker/coverage && stryker run config/stryker/stryker.conf.js",
Expand Down

0 comments on commit 8da5e45

Please sign in to comment.