From 4ef39a52a20be354ef5fb6394cc8f52f4a6db817 Mon Sep 17 00:00:00 2001 From: BryceLTaylor Date: Tue, 29 Mar 2022 17:13:04 -0400 Subject: [PATCH 1/4] output jest unit tests in junit format --- .circleci/config.yml | 2 +- .gitignore | 3 +++ package-lock.json | 41 +++++++++++++++++++++++++++++++++++++++++ package.json | 6 +++++- 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d2a2961..3c37299c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,7 +20,7 @@ aliases: command: npm run lint - &unit name: "run unit tests" - command: npm run unit + command: JEST_JUNIT_OUTPUT_NAME=unit-jest-results.xml npm run unit -- --reporters=jest-junit - &build name: "run npm build" command: | diff --git a/.gitignore b/.gitignore index c6c5feec..9a2237b0 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ dist/* # generated translation files /translations /locale + +# tests +/test/results/* diff --git a/package-lock.json b/package-lock.json index 6541d7a7..7a572758 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10238,6 +10238,41 @@ } } }, + "jest-junit": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-13.0.0.tgz", + "integrity": "sha512-JSHR+Dhb32FGJaiKkqsB7AR3OqWKtldLd6ZH2+FJ8D4tsweb8Id8zEVReU4+OlrRO1ZluqJLQEETm+Q6/KilBg==", + "dev": true, + "requires": { + "mkdirp": "^1.0.4", + "strip-ansi": "^6.0.1", + "uuid": "^8.3.2", + "xml": "^1.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true + } + } + }, "jest-leak-detector": { "version": "22.4.3", "resolved": "http://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-22.4.3.tgz", @@ -21460,6 +21495,12 @@ "async-limiter": "~1.0.0" } }, + "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 f1d4b019..7f99aa12 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "lint": "eslint . --ext .js,.jsx", "start": "webpack-dev-server", "test": "npm run lint && npm run unit && NODE_ENV=production npm run build", - "unit": "jest", + "unit": "jest --reporters=default", "watch": "webpack --progress --colors --watch" }, "author": "Massachusetts Institute of Technology", @@ -69,6 +69,7 @@ "html-webpack-plugin": "3.2.0", "jest": "22.4.4", "jest-canvas-mock": "2.3.1", + "jest-junit": "13.0.0", "json": "9.0.6", "lodash.defaultsdeep": "4.6.1", "mkdirp": "1.0.4", @@ -114,6 +115,9 @@ "\\.(css|less)$": "/test/__mocks__/styleMock.js" } }, + "jest-junit": { + "outputDirectory": "./test/results" + }, "browserslist": [ "last 3 versions", "Safari >= 8", From f28835d51cbc4e364063f07c73d1f727dc70db52 Mon Sep 17 00:00:00 2001 From: BryceLTaylor Date: Tue, 29 Mar 2022 17:13:41 -0400 Subject: [PATCH 2/4] circleci output linting to junit format --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3c37299c..751cfb73 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,7 +17,7 @@ aliases: mkdir ./test/results - &lint name: "run lint tests" - command: npm run lint + command: npm run lint -- --format junit -o ./test/results/lint-results.xml - &unit name: "run unit tests" command: JEST_JUNIT_OUTPUT_NAME=unit-jest-results.xml npm run unit -- --reporters=jest-junit From 6902ae2816530c4f9c870a25f14d8eb49e50dce3 Mon Sep 17 00:00:00 2001 From: BryceLTaylor Date: Tue, 29 Mar 2022 17:20:42 -0400 Subject: [PATCH 3/4] store test results in CircleCI should run on branches now --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 751cfb73..46101ee7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,6 +39,8 @@ jobs: <<: *unit - run: <<: *build + - store_test_results: + path: test/results workflows: build-test-no-deploy: From e75593d5c55a0729ecadb64a7b9da649e09f1b60 Mon Sep 17 00:00:00 2001 From: BryceLTaylor Date: Fri, 1 Apr 2022 09:58:24 -0400 Subject: [PATCH 4/4] Update to eslint-config-scratch 7 turns off no-warning-comments in line with WWW --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7a572758..fbc58ece 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5921,9 +5921,9 @@ "dev": true }, "eslint-config-scratch": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-scratch/-/eslint-config-scratch-6.0.0.tgz", - "integrity": "sha512-2aW7EVWhjTrwaM54hjAZeRETh/habWeQ5xzTbPO2dG//RtixBztUAmdxqAHKH8MEtmAMsUhf3mRjO1BstO4dGg==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-scratch/-/eslint-config-scratch-7.0.0.tgz", + "integrity": "sha512-8Ko7aaC+Gv09lyz3x7+EaVZ68ga/4mnfGgwH1Jz/MnR4UJyJyYtUOtlWxsPspPOlPZzDAVL5CKEcxmCX24SrJA==", "dev": true, "requires": { "eslint-plugin-react": ">=7.14.2" diff --git a/package.json b/package.json index 7f99aa12..e459a473 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "enzyme-adapter-react-16": "1.15.6", "eslint": "5.16.0", "eslint-config-import": "0.13.0", - "eslint-config-scratch": "6.0.0", + "eslint-config-scratch": "7.0.0", "eslint-plugin-import": "2.23.4", "eslint-plugin-react": "7.20.3", "gh-pages": "github:rschamp/gh-pages#publish-branch-to-subfolder",