Skip to content

Commit ac3aa9e

Browse files
committed
chore: 🤖 add junit test report output for api
1 parent f776ba0 commit ac3aa9e

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed

‎addons/api/.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@
1818

1919
# broccoli-debug
2020
/DEBUG/
21+
22+
# test reports
23+
/test-reports/

‎addons/api/package.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@
7676
"qunit": "^2.22.0",
7777
"qunit-dom": "^3.2.1",
7878
"sinon": "^19.0.2",
79+
"testem-gitlab-reporter": "^1.0.0",
80+
"testem-multi-reporter": "^1.2.0",
7981
"webpack": "^5.95.0"
8082
},
8183
"peerDependencies": {

‎addons/api/testem.js‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,36 @@
44
*/
55

66
'use strict';
7+
const MultiReporter = require('testem-multi-reporter');
8+
const JUnitReporter = require('testem-gitlab-reporter');
9+
const fs = require('fs');
10+
11+
// testem is provided by ember-cli and is not an explicit dependency
12+
// eslint-disable-next-line n/no-extraneous-require
13+
const TAPReporter = require('testem/lib/reporters/tap_reporter');
14+
15+
const multiReporterConfig = {
16+
reporters: [
17+
{
18+
ReporterClass: TAPReporter,
19+
args: [false, null, { get: () => false }],
20+
},
21+
],
22+
};
23+
24+
if (process.env.CREATE_JUNIT_TEST_REPORT === 'true') {
25+
!fs.existsSync('./test-reports') && fs.mkdirSync('./test-reports');
26+
multiReporterConfig.reporters.push({
27+
ReporterClass: JUnitReporter,
28+
args: [
29+
false,
30+
fs.createWriteStream('test-reports/junit.xml'),
31+
{ get: () => false },
32+
],
33+
});
34+
}
35+
36+
let reporter = new MultiReporter(multiReporterConfig);
737

838
module.exports = {
939
test_page: 'tests/index.html?hidepassed',
@@ -34,4 +64,5 @@ module.exports = {
3464
Firefox: ['-headless', '--window-size=1440,900'],
3565
},
3666
parallel: process.env.EMBER_EXAM_SPLIT_COUNT || 1,
67+
reporter,
3768
};

‎pnpm-lock.yaml‎

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)