Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🏗 ✨ ❄️ add karma-junit-reporter to store test results in a way circleci can interpret them #33682

Merged
merged 8 commits into from
Apr 12, 2021
14 changes: 14 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ commands:
name: 'Fail Fast'
when: on_fail
command: ./.circleci/fail_fast.sh
store_test_output:
steps:
- store_artifacts:
path: result-reports
- store_test_results:
path: result-reports

jobs:
'Compute Merge Commit':
Expand Down Expand Up @@ -179,6 +185,7 @@ jobs:
- run:
name: 'Validator Tests'
command: node build-system/pr-check/validator-tests.js
- store_test_output
- fail_fast
- teardown_vm
'Visual Diff Tests':
Expand All @@ -192,6 +199,7 @@ jobs:
- run:
name: 'Visual Diff Tests'
command: node build-system/pr-check/visual-diff-tests.js
- store_test_output
- fail_fast
- teardown_vm
'Unit Tests':
Expand All @@ -205,6 +213,7 @@ jobs:
- run:
name: 'Unit Tests'
command: node build-system/pr-check/unit-tests.js
- store_test_output
- fail_fast
- teardown_vm
'Unminified Tests':
Expand All @@ -218,6 +227,7 @@ jobs:
- run:
name: 'Unminified Tests'
command: node build-system/pr-check/unminified-tests.js
- store_test_output
- fail_fast
- teardown_vm
'Nomodule Tests':
Expand All @@ -236,6 +246,7 @@ jobs:
- run:
name: 'Nomodule Tests (<< parameters.config >>)'
command: node build-system/pr-check/nomodule-tests.js --config=<< parameters.config >>
- store_test_output
- fail_fast
- teardown_vm
'Module Tests':
Expand All @@ -254,6 +265,7 @@ jobs:
- run:
name: 'Module Tests (<< parameters.config >>)'
command: node build-system/pr-check/module-tests.js --config=<< parameters.config >>
- store_test_output
- fail_fast
- teardown_vm
'End-to-End Tests':
Expand All @@ -280,6 +292,7 @@ jobs:
- run:
name: 'Performance Tests'
command: node build-system/pr-check/performance-tests.js
- store_test_output
- fail_fast
- teardown_vm
'Experiment Build':
Expand Down Expand Up @@ -316,6 +329,7 @@ jobs:
- run:
name: 'Experiment << parameters.exp >> Tests'
command: node build-system/pr-check/experiment-tests.js --experiment=experiment<< parameters.exp >>
- store_test_output
- fail_fast
- teardown_vm

Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ out/**
test/coverage/**
.babel-cache/**
.css-cache/**
result-reports/**

# Code directories
build-system/tasks/visual-diff/snippets/*.js
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
**/dist.3p/**
**/dist.tools/**
extensions/**/dist/**
result-reports/**
10 changes: 9 additions & 1 deletion build-system/tasks/runtime-test/runtime-test-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const {cyan, green, red, yellow} = require('kleur/colors');
const {dotWrappingWidth} = require('../../common/logging');
const {getEsbuildBabelPlugin} = require('../../common/esbuild-babel');
const {getFilesFromArgv} = require('../../common/utils');
const {isCiBuild} = require('../../common/ci');
const {isCiBuild, isCircleciBuild} = require('../../common/ci');
const {log} = require('../../common/logging');
const {reportTestStarted} = require('../report-test-status');
const {SERVER_TRANSFORM_PATH} = require('../../server/typescript-compile');
Expand Down Expand Up @@ -173,6 +173,14 @@ function updateReporters(config) {
config.reporters = ['mocha'];
}

if (isCircleciBuild()) {
config.reporters.push('junit');
config.junitReporter = {
outputFile: `result-reports/${config.testType}.xml`,
useBrowserName: false,
};
}

if (argv.coverage) {
config.reporters.push('coverage-istanbul');
}
Expand Down
1 change: 1 addition & 0 deletions build-system/test-configs/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ module.exports = {
'karma-html2js-preprocessor',
'karma-ie-launcher',
'karma-structured-json-reporter',
'karma-junit-reporter',
'karma-mocha',
'karma-mocha-reporter',
'karma-safarinative-launcher',
Expand Down
90 changes: 90 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
"karma-fixture": "0.2.6",
"karma-html2js-preprocessor": "1.1.0",
"karma-ie-launcher": "1.0.0",
"karma-junit-reporter": "2.0.1",
"karma-mocha": "2.0.1",
"karma-mocha-reporter": "2.2.5",
"karma-safarinative-launcher": "1.1.0",
Expand All @@ -148,6 +149,7 @@
"minimatch": "3.0.4",
"minimist": "1.2.5",
"mocha": "8.3.2",
"mocha-junit-reporter": "2.0.0",
"mocha-silent-reporter": "1.0.0",
"morgan": "1.10.0",
"multer": "1.4.2",
Expand Down