Run and report individually and in parallel

This commit is contained in:
dannyrb 2019-07-18 10:26:33 -04:00
parent b8baae7c25
commit 31357ea9b5
13 changed files with 23 additions and 27 deletions

View File

@ -49,7 +49,7 @@ jobs:
# https://www.viget.com/articles/using-junit-on-circleci-2-0-with-jest-and-eslint/ # https://www.viget.com/articles/using-junit-on-circleci-2-0-with-jest-and-eslint/
- run: - run:
name: "JavaScript Test Suite" name: "JavaScript Test Suite"
command: yarn run test:unit command: yarn run test:unit:ci
environment: environment:
JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml" JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml"

View File

@ -15,6 +15,13 @@
... ...
## Commands
| Commands | | |
| -------------- | --- | ----------------------------------------------------- |
| `test:unit` | | Jest multi-project test runner; overall coverage |
| `test:unit:ci` | | Runs tests in parallel. Reports coverage per project. |
## Developing ## Developing
The OHIF Medical Image Viewing Platform is maintained as a The OHIF Medical Image Viewing Platform is maintained as a

View File

@ -45,6 +45,6 @@ module.exports = {
build: { build: {
ignore: ["**/*.test.jsx", "**/*.test.js", "__snapshots__", "__tests__"] ignore: ["**/*.test.jsx", "**/*.test.js", "__snapshots__", "__tests__"]
} }
}, }
ignore: ["node_modules"] // ignore: ["node_modules"]
}; };

View File

@ -14,8 +14,11 @@
"cm": "npx git-cz", "cm": "npx git-cz",
"start": "lerna run lerna:start --parallel", "start": "lerna run lerna:start --parallel",
"build": "lerna run lerna:build --parallel", "build": "lerna run lerna:build --parallel",
"test": "jest --ci --runInBand --collectCoverage", "test:ci": "",
"test:unit": "lerna run lerna:test:unit --parallel", "test:unit": "jest --collectCoverage",
"test:unit:ci": "lerna run test:unit:ci --parallel",
"test:e2e": "",
"test:e2e:ci": "lerna run lerna:test:e2e --parallel",
"new-version": "lerna version --conventional-commits --yes", "new-version": "lerna version --conventional-commits --yes",
"build:pwa:ci": "" "build:pwa:ci": ""
}, },

View File

@ -0,0 +1 @@
module.exports = require("../../babel.config.js");

View File

@ -15,13 +15,12 @@
"npm": ">=5" "npm": ">=5"
}, },
"scripts": { "scripts": {
"cm": "npx git-cz", "test:unit:ci": "jest --ci --runInBand --collectCoverage && codecov -F core",
"build": "rollup -c", "build": "rollup -c",
"lerna:build": "webpack --config config/webpack.prod.js -w -d", "lerna:build": "webpack --config config/webpack.prod.js -w -d",
"dev": "jest --watch", "dev": "jest --watch",
"start": "rollup -c -w", "start": "rollup -c -w",
"test": "jest", "test": "jest",
"test:ci": "jest --ci --runInBand --collectCoverage --reporters=default --reporters=jest-junit && codecov",
"lint": "eslint -c .eslintrc --fix src && prettier --single-quote --write src/**/*.{js,jsx,json,css}", "lint": "eslint -c .eslintrc --fix src && prettier --single-quote --write src/**/*.{js,jsx,json,css}",
"prepublishOnly": "npm run build" "prepublishOnly": "npm run build"
}, },

View File

@ -0,0 +1 @@
module.exports = require("../../babel.config.js");

View File

@ -18,6 +18,7 @@
"access": "public" "access": "public"
}, },
"scripts": { "scripts": {
"test:unit:ci": "echo 'platform/i18n: missing unit tests'",
"build": "rollup -c", "build": "rollup -c",
"lerna:build": "webpack --config config/webpack.prod.js -w -d", "lerna:build": "webpack --config config/webpack.prod.js -w -d",
"prepublishOnly": "npm run build", "prepublishOnly": "npm run build",

View File

@ -1,18 +0,0 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"ie": "11"
}
}
],
"@babel/preset-react"
],
"plugins": [
"inline-react-svg",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-runtime"
]
}

View File

@ -0,0 +1 @@
module.exports = require("../../babel.config.js");

View File

@ -15,7 +15,7 @@
"dist" "dist"
], ],
"scripts": { "scripts": {
"lerna:test:unit": "jest --ci --runInBand --collectCoverage && codecov -F ui", "test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests && codecov -F ui",
"dev": "docz dev", "dev": "docz dev",
"test:watch": "react-scripts test --env=jsdom --transformIgnorePatterns \"node_modules/(?!react-dnd)/\"", "test:watch": "react-scripts test --env=jsdom --transformIgnorePatterns \"node_modules/(?!react-dnd)/\"",
"lerna:build": "webpack --config config/webpack.prod.js -w -d", "lerna:build": "webpack --config config/webpack.prod.js -w -d",

View File

@ -0,0 +1 @@
module.exports = require("../../babel.config.js");

View File

@ -14,7 +14,7 @@
"proxy": "http://localhost:8042", "proxy": "http://localhost:8042",
"scripts": { "scripts": {
"lerna:start": "cross-env NODE_ENV=development webpack-dev-server --config config/webpack.dev.js --mode development -w -d", "lerna:start": "cross-env NODE_ENV=development webpack-dev-server --config config/webpack.dev.js --mode development -w -d",
"lerna:test:unit": "jest --ci --runInBand --collectCoverage && codecov -F viewer", "test:unit:ci": "jest --ci --runInBand --collectCoverage && codecov -F viewer",
"dev": "yarn run preBuild && react-scripts start", "dev": "yarn run preBuild && react-scripts start",
"dev:debug": "react-scripts start", "dev:debug": "react-scripts start",
"build:package": "yarn run preBuild && node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c", "build:package": "yarn run preBuild && node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c",