Skip to content

Commit

Permalink
ci: Parallelize jest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
damassi committed Apr 14, 2021
1 parent 2d1c1c4 commit ae83ef3
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
31 changes: 20 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,33 @@ workflows:
<<: *only_development

# pre-staging
- hokusai/test:
name: test
- yarn/run:
name: test-jest-v1
<<: *not_staging_or_release
post-steps:
- run: mkdir -p ./coverage
- run:
name: Copy coverage artifacts
command: docker cp hokusai_metaphysics_1:/app/coverage ./
when: always
- codecov/upload:
file: ./coverage/lcov.info
script: "test:jest:v1"

- yarn/run:
name: test-jest-v2
<<: *not_staging_or_release
script: "test:jest:v2"

# TODO: Reenable code-cov uploads
# post-steps:
# - run: mkdir -p ./coverage
# - run:
# name: Copy coverage artifacts
# command: docker cp hokusai_metaphysics_1:/app/coverage ./
# when: always
# - codecov/upload:
# file: ./coverage/lcov.info

# staging
- hokusai/push:
name: push-staging-image
<<: *only_master
requires:
- test
- test-jest-v1
- test-jest-v2

- hokusai/deploy-staging:
name: deploy-staging
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ const v2Config = require("./jest.config.v2").projects[0]
const v1Config = require("./jest.config.v1").projects[0]

module.exports = {
projects: [v2Config, v1Config], // this order is necessary
projects: [v1Config, v2Config],
}
1 change: 0 additions & 1 deletion jest.config.v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module.exports = {
projects: [
{
displayName: "v1",
// moduleDirectories: ["node_modules"],
moduleFileExtensions: ["js", "jsx", "json", "ts", "tsx"],
setupFilesAfterEnv: ["jest-extended", "<rootDir>/src/test/helper.js"],
testMatch: ["**/v1/**/?(*.)+(test).[jt]s"],
Expand Down
2 changes: 1 addition & 1 deletion jest.config.v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
collectCoverage: true,
coverageReporters: ["lcov", "text-summary"],
moduleFileExtensions: ["js", "jsx", "json", "ts", "tsx"],
setupFilesAfterEnv: ["jest-extended", "<rootDir>/src/test/helper.js"],
testRegex: "(.test)\\.(js|ts)$",
testPathIgnorePatterns: [
"/node_modules/",
Expand All @@ -21,7 +22,6 @@ module.exports = {
transform: {
"^.+\\.(js|ts)$": "babel-jest",
},
setupFilesAfterEnv: ["jest-extended", "<rootDir>/src/test/helper.js"],
},
],
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"schema-drift": "babel-node --no-warnings --extensions '.ts,.js' ./scripts/schema-drift.ts",
"start": "yarn run dev",
"test": "yarn type-check && yarn lint && jest",
"test:ci:jest:v1": "yarn jest --config jest.config.v1.js",
"test:ci:jest:v2": "yarn jest --config jest.config.v2.js",
"test:jest:v1": "yarn jest --config jest.config.v1.js",
"test:jest:v2": "yarn jest --config jest.config.v2.js",
"test:debug": "node --inspect node_modules/.bin/jest --runInBand",
"test:validQueries": "babel-node --extensions '.ts,.js' src/integration/__tests__/runStoredQueryTests.ts",
"type-check": "tsc --noEmit --pretty",
Expand Down

0 comments on commit ae83ef3

Please sign in to comment.