diff --git a/.circleci/config.yml b/.circleci/config.yml index bd7493f6b..dd98d8c41 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,6 +21,12 @@ jobs: at: ~/coralproject/talk - restore_cache: key: dependency-cache-{{ checksum "package-lock.json" }} + - run: + name: Update NPM + command: sudo npm update -g npm + - run: + name: Audit dependencies + command: npm audit - run: name: Install dependencies command: npm install @@ -46,6 +52,10 @@ jobs: # unit_tests will run the unit tests. unit_tests: <<: *job_defaults + environment: + <<: *job_environment + CI: true + JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml" steps: - checkout - attach_workspace: @@ -55,7 +65,13 @@ jobs: command: npm run compile - run: name: Perform testing - command: npm run test + # We're running these tests in band to avoid errors where the circleci + # test runner runs out of RAM trying to run them all in parallel. + command: npm run test -- --ci --runInBand --testResultsProcessor="jest-junit" + - store_test_results: + path: reports/junit + - store_artifacts: + path: reports/junit # build will build the static assets and server typescript files. build: diff --git a/package-lock.json b/package-lock.json index ef871d5e2..4f66c4e68 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12421,6 +12421,35 @@ "pretty-format": "^23.2.0" } }, + "jest-junit": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-5.1.0.tgz", + "integrity": "sha512-3EVf1puv2ox5wybQDfLX3AEn3IKOgDV4E76y4pO2hBu46DEtAFZZAm//X1pzPQpqKji0zqgMIzqzF/K+uGAX9A==", + "dev": true, + "requires": { + "jest-validate": "^23.0.1", + "mkdirp": "^0.5.1", + "strip-ansi": "^4.0.0", + "xml": "^1.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, "jest-leak-detector": { "version": "23.2.0", "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-23.2.0.tgz", @@ -23151,6 +23180,12 @@ "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", "dev": true }, + "xml": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", + "integrity": "sha1-eLpyAgApxbyHuKgaPPzXS0ovweU=", + "dev": true + }, "xml-name-validator": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", diff --git a/package.json b/package.json index b6a2f6697..b3f29fe42 100644 --- a/package.json +++ b/package.json @@ -113,6 +113,7 @@ "graphql-playground-middleware-express": "^1.7.2", "html-webpack-plugin": "^3.2.0", "jest": "^23.4.1", + "jest-junit": "^5.1.0", "jsdom": "^11.11.0", "loader-utils": "^1.1.0", "material-design-icons": "^3.0.1", diff --git a/scripts/test.js b/scripts/test.js index f08b18de6..59c8a93cc 100644 --- a/scripts/test.js +++ b/scripts/test.js @@ -22,7 +22,11 @@ let argv = process.argv.slice(2); argv.push("--config", paths.appJestConfig); // Watch unless on CI or in coverage mode -if (!process.env.CI && argv.indexOf("--coverage") < 0) { +if ( + !process.env.CI && // ensure that the ci env var is not set. + argv.indexOf("--ci") < 0 && // ensure that the ci flag is not passed + argv.indexOf("--coverage") < 0 // ensure that the coverage flag is not passed +) { argv.push("--watch"); }