diff --git a/.circleci/config.yml b/.circleci/config.yml index 9ed8e86bc..43369aa5d 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:ci + command: yarn run test:unit environment: JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml" diff --git a/README.md b/README.md index 84e6790a5..584097578 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,20 @@ ## Commands +### Global + | Commands | | | | -------------- | --- | ----------------------------------------------------- | | `test:unit` | | Jest multi-project test runner; overall coverage | | `test:unit:ci` | | Runs tests in parallel. Reports coverage per project. | +### Local + +| Commands | | | +| -------------- | --- | ------------------------------------------------- | +| `test:unit` | | Runs tests while watching for changes | +| `test:unit:ci` | | Runs tests, collects coverage, reports to codecov | + ## Developing The OHIF Medical Image Viewing Platform is maintained as a diff --git a/package.json b/package.json index f7777fb4e..e1279c949 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "start": "lerna run lerna:start --parallel", "build": "lerna run lerna:build --parallel", "test:ci": "", - "test:unit": "jest --collectCoverage", + "test:unit": "jest --ci --runInBand --collectCoverage && codecov", "test:unit:ci": "lerna run test:unit:ci --parallel", "test:e2e": "", "test:e2e:ci": "lerna run lerna:test:e2e --parallel", diff --git a/platform/core/package.json b/platform/core/package.json index 7359def0b..07c67a090 100644 --- a/platform/core/package.json +++ b/platform/core/package.json @@ -15,12 +15,12 @@ "npm": ">=5" }, "scripts": { + "test:unit": "jest --watch", "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", "lint": "eslint -c .eslintrc --fix src && prettier --single-quote --write src/**/*.{js,jsx,json,css}", "prepublishOnly": "npm run build" }, diff --git a/platform/i18n/package.json b/platform/i18n/package.json index 412c28cde..6c8e8bed4 100644 --- a/platform/i18n/package.json +++ b/platform/i18n/package.json @@ -18,6 +18,7 @@ "access": "public" }, "scripts": { + "test:unit": "echo 'platform/i18n: missing unit tests'", "test:unit:ci": "echo 'platform/i18n: missing unit tests'", "build": "rollup -c", "lerna:build": "webpack --config config/webpack.prod.js -w -d", diff --git a/platform/ui/package.json b/platform/ui/package.json index 1cca561e1..040955603 100644 --- a/platform/ui/package.json +++ b/platform/ui/package.json @@ -15,9 +15,9 @@ "dist" ], "scripts": { + "test:unit": "jest --watch", "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", "build": "rollup -c", "start": "rollup -c -w", diff --git a/platform/viewer/package.json b/platform/viewer/package.json index 70e879fa4..59eb919e6 100644 --- a/platform/viewer/package.json +++ b/platform/viewer/package.json @@ -14,6 +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", + "test:unit": "jest --watch", "test:unit:ci": "jest --ci --runInBand --collectCoverage && codecov -F viewer", "dev": "yarn run preBuild && react-scripts start", "dev:debug": "react-scripts start", @@ -21,7 +22,6 @@ "build:package:ci": "yarn run preBuild && node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c", "build:web": "yarn run preBuild && react-scripts --max_old_space_size=4096 build", "build:demo:ci": "yarn run preBuild && cross-env PUBLIC_URL=/ REACT_APP_CONFIG=config/demo.js react-scripts --max_old_space_size=4096 build", - "test:unit": "jest", "test:e2e:ci": "start-server-and-test start http://localhost:5000 cy:run:ci", "start": "yarn run dev", "predeploy": "cd example && npm install && yarn run build:package",