Skip to content

Commit

Permalink
Add junit reporting to Jest and ci pipeline (#32)
Browse files Browse the repository at this point in the history
* Add junit reporting to Jest and ci pipeline

* Update circleCI variables

* Update vars again

* Try storing articafts too

* Improve reporting language
  • Loading branch information
timmydoza authored and timmydoza committed Mar 6, 2020
1 parent 3299ef0 commit 5986959
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 4 deletions.
14 changes: 13 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,19 @@ jobs:

- run: npm ci

- run: npm test -- --runInBand
- run:
name: "Jest Unit Tests"
command: npm run test:ci
environment:
JEST_JUNIT_OUTPUT_DIR: "test-reports/jest"
JEST_JUNIT_OUTPUT_NAME: "results.xml"
JEST_JUNIT_CLASSNAME: "{classname}"
JEST_JUNIT_TITLE: "{title}"

- store_test_results:
path: test-reports
- store_artifacts:
path: coverage

- run: npm run build

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ yarn-error.log*

.env
.vscode

test-reports
junit.xml
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ module.exports = {
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
snapshotSerializers: ['enzyme-to-json/serializer'],
setupFiles: ['<rootDir>/src/setupTests.ts']
setupFiles: ['<rootDir>/src/setupTests.ts'],
reporters: ['default', 'jest-junit'],
};
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"express": "^4.17.1",
"fscreen": "^1.0.2",
"husky": "^3.0.9",
"jest-junit": "^9.0.0",
"lint-staged": "^9.4.2",
"prettier": "^1.18.2",
"react": "^16.10.2",
Expand Down Expand Up @@ -52,7 +53,8 @@
"test": "jest",
"eject": "react-scripts eject",
"lint": "eslint src/**/*.{ts,tsx}",
"server": "node server.js"
"server": "node server.js",
"test:ci": "jest --ci --runInBand --reporters=default --reporters=jest-junit --coverage"
},
"eslintConfig": {
"extends": "react-app",
Expand All @@ -77,5 +79,8 @@
"pre-commit": "lint-staged"
}
},
"proxy": "http://localhost:8080/"
"proxy": "http://localhost:8080/",
"jest": {
"snapshotSerializers": ["enzyme-to-json/serializer"]
}
}

0 comments on commit 5986959

Please sign in to comment.