From 31357ea9b56a5ad5b469dbaef38ecdb45f7de64c Mon Sep 17 00:00:00 2001 From: dannyrb Date: Thu, 18 Jul 2019 10:26:33 -0400 Subject: [PATCH] Run and report individually and in parallel --- .circleci/config.yml | 2 +- README.md | 7 +++++++ babel.config.js | 4 ++-- package.json | 7 +++++-- platform/core/babel.config.js | 1 + platform/core/package.json | 3 +-- platform/i18n/babel.config.js | 1 + platform/i18n/package.json | 1 + platform/ui/.babelrc | 18 ------------------ platform/ui/babel.config.js | 1 + platform/ui/package.json | 2 +- platform/viewer/babel.config.js | 1 + platform/viewer/package.json | 2 +- 13 files changed, 23 insertions(+), 27 deletions(-) create mode 100644 platform/core/babel.config.js create mode 100644 platform/i18n/babel.config.js delete mode 100644 platform/ui/.babelrc create mode 100644 platform/ui/babel.config.js create mode 100644 platform/viewer/babel.config.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 43369aa5d..9ed8e86bc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,7 +49,7 @@ jobs: # https://www.viget.com/articles/using-junit-on-circleci-2-0-with-jest-and-eslint/ - run: name: "JavaScript Test Suite" - command: yarn run test:unit + command: yarn run test:unit:ci environment: JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml" diff --git a/README.md b/README.md index 8fa06e366..84e6790a5 100644 --- a/README.md +++ b/README.md @@ -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 The OHIF Medical Image Viewing Platform is maintained as a diff --git a/babel.config.js b/babel.config.js index 74afe92cd..e3d272ca8 100644 --- a/babel.config.js +++ b/babel.config.js @@ -45,6 +45,6 @@ module.exports = { build: { ignore: ["**/*.test.jsx", "**/*.test.js", "__snapshots__", "__tests__"] } - }, - ignore: ["node_modules"] + } + // ignore: ["node_modules"] }; diff --git a/package.json b/package.json index 502b8cb2c..f7777fb4e 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,11 @@ "cm": "npx git-cz", "start": "lerna run lerna:start --parallel", "build": "lerna run lerna:build --parallel", - "test": "jest --ci --runInBand --collectCoverage", - "test:unit": "lerna run lerna:test:unit --parallel", + "test:ci": "", + "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", "build:pwa:ci": "" }, diff --git a/platform/core/babel.config.js b/platform/core/babel.config.js new file mode 100644 index 000000000..fed6f05fe --- /dev/null +++ b/platform/core/babel.config.js @@ -0,0 +1 @@ +module.exports = require("../../babel.config.js"); diff --git a/platform/core/package.json b/platform/core/package.json index 4439798f6..7359def0b 100644 --- a/platform/core/package.json +++ b/platform/core/package.json @@ -15,13 +15,12 @@ "npm": ">=5" }, "scripts": { - "cm": "npx git-cz", + "test:unit:ci": "jest --ci --runInBand --collectCoverage && codecov -F core", "build": "rollup -c", "lerna:build": "webpack --config config/webpack.prod.js -w -d", "dev": "jest --watch", "start": "rollup -c -w", "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}", "prepublishOnly": "npm run build" }, diff --git a/platform/i18n/babel.config.js b/platform/i18n/babel.config.js new file mode 100644 index 000000000..fed6f05fe --- /dev/null +++ b/platform/i18n/babel.config.js @@ -0,0 +1 @@ +module.exports = require("../../babel.config.js"); diff --git a/platform/i18n/package.json b/platform/i18n/package.json index 0f2d27855..412c28cde 100644 --- a/platform/i18n/package.json +++ b/platform/i18n/package.json @@ -18,6 +18,7 @@ "access": "public" }, "scripts": { + "test:unit:ci": "echo 'platform/i18n: missing unit tests'", "build": "rollup -c", "lerna:build": "webpack --config config/webpack.prod.js -w -d", "prepublishOnly": "npm run build", diff --git a/platform/ui/.babelrc b/platform/ui/.babelrc deleted file mode 100644 index 3f85000fd..000000000 --- a/platform/ui/.babelrc +++ /dev/null @@ -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" - ] -} diff --git a/platform/ui/babel.config.js b/platform/ui/babel.config.js new file mode 100644 index 000000000..fed6f05fe --- /dev/null +++ b/platform/ui/babel.config.js @@ -0,0 +1 @@ +module.exports = require("../../babel.config.js"); diff --git a/platform/ui/package.json b/platform/ui/package.json index 04b815dfe..1cca561e1 100644 --- a/platform/ui/package.json +++ b/platform/ui/package.json @@ -15,7 +15,7 @@ "dist" ], "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", "test:watch": "react-scripts test --env=jsdom --transformIgnorePatterns \"node_modules/(?!react-dnd)/\"", "lerna:build": "webpack --config config/webpack.prod.js -w -d", diff --git a/platform/viewer/babel.config.js b/platform/viewer/babel.config.js new file mode 100644 index 000000000..fed6f05fe --- /dev/null +++ b/platform/viewer/babel.config.js @@ -0,0 +1 @@ +module.exports = require("../../babel.config.js"); diff --git a/platform/viewer/package.json b/platform/viewer/package.json index 088ded6fe..70e879fa4 100644 --- a/platform/viewer/package.json +++ b/platform/viewer/package.json @@ -14,7 +14,7 @@ "proxy": "http://localhost:8042", "scripts": { "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:debug": "react-scripts start", "build:package": "yarn run preBuild && node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c",