Skip to content

Commit

Permalink
Split unit tests into two jobs. Fix JEST report output
Browse files Browse the repository at this point in the history
  • Loading branch information
alisman committed May 25, 2022
1 parent 6ccb8cf commit 8f918e0
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 14 deletions.
34 changes: 29 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,34 @@ jobs:
- run:
command: "yarn run test"
environment:
JUNIT_REPORT_PATH: ./junit/
JUNIT_REPORT_NAME: test-results.xml
JEST_JUNIT_OUTPUT_DIR: ./junit/unit/main/
JEST_JUNIT_OUTPUT_NAME: test-results-unit-main.xml
NODE_OPTIONS: --max-old-space-size=4096
DISABLE_SOURCEMAP: true
WEBPACK_PARALLEL: false
when: always
- store_test_results:
path: /tmp/repo/junit
- store_artifacts:
path: /tmp/repo/junit
path: ./junit/unit/main/

unit_tests_packages:
<<: *defaults
steps:
# - run:
# name: "Install yarn at specific version"
# command:
# sudo npm install --global yarn@1.22.4
- attach_workspace:
at: /tmp/
# run tests!
- run:
command: "yarn run testModulesCI"
environment:
DISABLE_SOURCEMAP: true
NODE_OPTIONS: --max-old-space-size=4096
WEBPACK_PARALLEL: false
when: always
- store_test_results:
path: /tmp/junit/module/

check_forgotten_spec_only_statements:
<<: *defaults
Expand Down Expand Up @@ -350,6 +368,9 @@ workflows:
- unit_tests:
requires:
- install
- unit_tests_packages:
requires:
- install
- end_to_end_tests:
requires:
- install
Expand Down Expand Up @@ -382,6 +403,9 @@ workflows:
- unit_tests:
requires:
- install
- unit_tests_packages:
requires:
- install
- end_to_end_tests:
requires:
- install
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
"serveDist": "./scripts/serve_dist.sh",
"serveDistLocalDb": "./end-to-end-test/local/runtime-config/serve_dist.sh",
"testTime": "start_time=`date +%s` && karma start karma.conf.js && echo run time is $(expr `date +%s` - $start_time) s",
"test": "yarn run testModules && yarn run testMain",
"testMain": "cross-env CI=1 jest --env=jsdom --runInBand",
"test": "yarn run testMain",
"testMain": "jest TableHeaderControls.spec.tsx --env=jsdom --runInBand --ci --reporters=default --reporters=jest-junit",
"testModulesCI" : "JEST_JUNIT_UNIQUE_OUTPUT_NAME=true JEST_JUNIT_OUTPUT_DIR=/tmp/junit/module/ JEST_JUNIT_OUTPUT_NAME=unit-test-module yarn run testModules",
"testModules": "lerna run test --ignore=cbioportal-frontend --stream",
"test:watch": "yarn run testMain:watch",
"testMain:watch": "yarn run testMain --watch",
Expand Down Expand Up @@ -354,6 +355,7 @@
"jest": "^27.2.1",
"jest-canvas-mock": "^2.3.1",
"jest-environment-jsdom": "^27.2.0",
"jest-junit": "^13.2.0",
"json": "^9.0.6",
"netlify": "^8.0.1",
"node-fetch": "^2.6.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/cbioportal-clinical-timeline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"tcm": "tcm -p src/**/*.module.scss",
"tcm:watch": "yarn run tcm --watch",
"prepare": "yarn run build",
"test": "cross-env CI=1 jest --env=jsdom --runInBand",
"test": "cross-env jest --env=jsdom --runInBand --ci --reporters=default --reporters=jest-junit",
"test:watch": "yarn run test --watch"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cbioportal-frontend-commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"tcm": "tcm -p src/**/*.module.scss",
"tcm:watch": "yarn run tcm --watch",
"prepare": "yarn run build",
"test": "cross-env CI=1 jest --env=jsdom --runInBand",
"test": "cross-env jest --env=jsdom --runInBand --ci --reporters=default --reporters=jest-junit",
"test:watch": "yarn run test --watch"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cbioportal-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"rollup": "rollup -c rollup.config.ts",
"rollup:watch": "rollup -c rollup.config.ts -w",
"prepare": "yarn run build",
"test": "cross-env CI=1 jest --env=jsdom --runInBand",
"test": "cross-env jest --env=jsdom --runInBand --ci --reporters=default --reporters=jest-junit",
"test:watch": "yarn run test --watch"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-mutation-mapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"tcm": "tcm -p src/**/*.module.scss",
"tcm:watch": "yarn run tcm --watch",
"prepare": "yarn run build",
"test": "cross-env CI=1 jest --env=jsdom --runInBand",
"test": "cross-env jest --env=jsdom --runInBand --ci --reporters=default --reporters=jest-junit",
"test:watch": "yarn run test --watch"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ describe('TableHeaderControls', () => {
it('bindCopyButton is called only when there is a copy button and props flag is true', () => {
let mockInstance = {
bindCopyButton: sinon.stub(),
props: { showCopyAndDownload: true },
showCopyAndDownload: true,
_copyButton: {},
};

TableHeaderControls.prototype.componentDidMount.apply(mockInstance);

assert.isTrue(mockInstance.bindCopyButton.calledOnce);
assert.isTrue(mockInstance.bindCopyButton.called);

mockInstance = {
bindCopyButton: sinon.stub(),
props: { showCopyAndDownload: false },
showCopyAndDownload: false,
_copyButton: {},
};

Expand Down
37 changes: 37 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5490,6 +5490,11 @@ ansi-regex@^5.0.0:
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75"
integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==

ansi-regex@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==

ansi-regex@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.0.0.tgz#ecc7f5933cbe5ac7b33e209a5ff409ab1669c6b2"
Expand Down Expand Up @@ -14731,6 +14736,16 @@ jest-jasmine2@^27.2.1:
pretty-format "^27.2.0"
throat "^6.0.1"

jest-junit@^13.2.0:
version "13.2.0"
resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-13.2.0.tgz#66eeb86429aafac8c1745a70f44ace185aacb943"
integrity sha512-B0XNlotl1rdsvFZkFfoa19mc634+rrd8E4Sskb92Bb8MmSXeWV9XJGUyctunZS1W410uAxcyYuPUGVnbcOH8cg==
dependencies:
mkdirp "^1.0.4"
strip-ansi "^6.0.1"
uuid "^8.3.2"
xml "^1.0.1"

jest-leak-detector@^27.2.0:
version "27.2.0"
resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-27.2.0.tgz#9a7ca2dad1a21c4e49ad2a8ad7f1214ffdb86a28"
Expand Down Expand Up @@ -17098,6 +17113,11 @@ mkdirp@^0.5.5:
dependencies:
minimist "^1.2.5"

mkdirp@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==

mobx-logger@^0.7.1:
version "0.7.1"
resolved "https://registry.yarnpkg.com/mobx-logger/-/mobx-logger-0.7.1.tgz#6be44c726e14433463f5fa566f24f1768e2a9355"
Expand Down Expand Up @@ -23522,6 +23542,13 @@ strip-ansi@^6.0.0:
dependencies:
ansi-regex "^5.0.0"

strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.0.tgz#1dc49b980c3a4100366617adac59327eefdefcb0"
Expand Down Expand Up @@ -24992,6 +25019,11 @@ uuid@^3.4.0:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==

uuid@^8.3.2:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==

uvu@^0.5.0:
version "0.5.2"
resolved "https://registry.yarnpkg.com/uvu/-/uvu-0.5.2.tgz#c145e7f4b5becf80099cf22fd8a4a05f0112b2c0"
Expand Down Expand Up @@ -26018,6 +26050,11 @@ xml2js@^0.4.23:
sax ">=0.6.0"
xmlbuilder "~11.0.0"

xml@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
integrity sha1-eLpyAgApxbyHuKgaPPzXS0ovweU=

xmlbuilder@~11.0.0:
version "11.0.1"
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3"
Expand Down

0 comments on commit 8f918e0

Please sign in to comment.