diff --git a/.circleci/config.yml b/.circleci/config.yml index 7789f342e9..261290d418 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -70,7 +70,11 @@ jobs: steps: - base-install: package: << parameters.package >> - - run: ./.circleci/test-package.sh << parameters.package >> + - run: + name: Testing << parameters.package >> + command: ./.circleci/test-package.sh << parameters.package >> + - store_test_results: + path: artifacts/tests - run: name: Reporting code coverage... command: bash <(curl -s https://codecov.io/bash) -X gcov diff --git a/packages/fxa-auth-server/package.json b/packages/fxa-auth-server/package.json index 06e9e39cd8..3335af9a8f 100644 --- a/packages/fxa-auth-server/package.json +++ b/packages/fxa-auth-server/package.json @@ -137,6 +137,7 @@ "mailparser": "0.6.1", "mkdirp": "0.5.1", "mocha": "^7.1.2", + "mocha-junit-reporter": "^2.0.0", "moment": "^2.24.0", "nock": "^12.0.3", "nodemon": "^2.0.3", diff --git a/packages/fxa-auth-server/scripts/mocha-coverage.js b/packages/fxa-auth-server/scripts/mocha-coverage.js index 1a8ac10cca..f38655b5ab 100755 --- a/packages/fxa-auth-server/scripts/mocha-coverage.js +++ b/packages/fxa-auth-server/scripts/mocha-coverage.js @@ -25,7 +25,6 @@ const argv = [ '--cache', '--no-clean', '--reporter=lcov', - '--reporter=text', '--report-dir=coverage', MOCHA_BIN, ]; diff --git a/packages/fxa-auth-server/scripts/test-ci.sh b/packages/fxa-auth-server/scripts/test-ci.sh index cbe6ab42ab..858b11dd72 100755 --- a/packages/fxa-auth-server/scripts/test-ci.sh +++ b/packages/fxa-auth-server/scripts/test-ci.sh @@ -1,4 +1,22 @@ -#!/bin/bash -ex +#!/bin/bash -e + +DIR=$(dirname "$0") +cd "$DIR/.." yarn workspaces focus fxa-auth-server -yarn run test-ci + +export NODE_ENV=dev +export CORS_ORIGIN="http://foo,http://bar" + +DEFAULT_ARGS="--require ts-node/register --recursive --timeout 5000 --exit --reporter mocha-junit-reporter" + +node -r ts-node/register ./scripts/gen_keys.js +node -r ts-node/register ./scripts/gen_vapid_keys.js +node -r ts-node/register ./scripts/oauth_gen_keys.js +node -r ts-node/register ../fxa-auth-db-mysql/bin/db_patcher > /dev/null + +TESTS=(local oauth remote scripts) +for t in "${TESTS[@]}"; do + echo "testing $t" + ./scripts/mocha-coverage.js $DEFAULT_ARGS --reporter-options mochaFile="../../artifacts/tests/$t/test-results.xml" "test/$t" +done diff --git a/yarn.lock b/yarn.lock index be4b59e2af..d67e17b168 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17100,6 +17100,7 @@ fsevents@^1.2.7: memcached: 2.2.2 mkdirp: 0.5.1 mocha: ^7.1.2 + mocha-junit-reporter: ^2.0.0 moment: ^2.24.0 moment-timezone: 0.5.11 mozlog: 2.2.0 @@ -24992,7 +24993,7 @@ fsevents@^1.2.7: languageName: node linkType: hard -"md5@npm:^2.2.1": +"md5@npm:^2.1.0, md5@npm:^2.2.1": version: 2.2.1 resolution: "md5@npm:2.2.1" dependencies: @@ -25609,6 +25610,21 @@ fsevents@^1.2.7: languageName: node linkType: hard +"mocha-junit-reporter@npm:^2.0.0": + version: 2.0.0 + resolution: "mocha-junit-reporter@npm:2.0.0" + dependencies: + debug: ^2.2.0 + md5: ^2.1.0 + mkdirp: ~0.5.1 + strip-ansi: ^4.0.0 + xml: ^1.0.0 + peerDependencies: + mocha: ">=2.2.5" + checksum: 3/7a7e7b482a6a1d94a001c82429a930f4fe876fec939cd95a3e7e332f977cdab286f9c6ed901d5558a69acd2638d0a779c21096a1a13bb3bec8220dc0390f6660 + languageName: node + linkType: hard + "mocha-text-cov@npm:0.1.1": version: 0.1.1 resolution: "mocha-text-cov@npm:0.1.1" @@ -38276,6 +38292,13 @@ typescript@3.8.3: languageName: node linkType: hard +"xml@npm:^1.0.0": + version: 1.0.1 + resolution: "xml@npm:1.0.1" + checksum: 3/adde7652a6f6010d28079586e7f608d616138bcb6c44bbc9174292b5cc2fab09b351d6c5f009e9304df2e0030888198225dd2e9ccbf51b776c8928479bfea4cb + languageName: node + linkType: hard + "xmlbuilder@npm:0.4.2": version: 0.4.2 resolution: "xmlbuilder@npm:0.4.2"