@brightspace-ui/testing 1.17.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@brightspace-ui/testing",
3
3
  "description": "Utilities for testing front-end components and applications",
4
4
  "type": "module",
5
- "version": "1.17.0",
5
+ "version": "1.18.0",
6
6
  "repository": "https://github.com/BrightspaceUI/testing.git",
7
7
  "scripts": {
8
8
  "lint": "npm run lint:eslint && npm run lint:style",
@@ -52,6 +52,7 @@
52
52
  "@web/test-runner-playwright": "^0.11",
53
53
  "command-line-args": "^6",
54
54
  "command-line-usage": "^7",
55
+ "d2l-test-reporting": "^4",
55
56
  "glob": "^11",
56
57
  "lit": "^2 || ^3",
57
58
  "page": "^1",
@@ -121,6 +121,13 @@ async function getTestRunnerOptions(argv = []) {
121
121
  description: 'Run tests in Webkit',
122
122
  order: 4
123
123
  },
124
+ {
125
+ name: 'test-reporting',
126
+ type: Boolean,
127
+ defaultOption: false,
128
+ description: 'Enables generating a D2L Test Reporting format JSON file',
129
+ order: 14
130
+ }
124
131
  ];
125
132
 
126
133
  const cliArgs = commandLineArgs(optionDefinitions, { partial: true, argv });
@@ -1,6 +1,7 @@
1
1
  import { defaultReporter } from '@web/test-runner';
2
2
  import { headedMode } from './headed-mode-plugin.js';
3
3
  import { playwrightLauncher } from '@web/test-runner-playwright';
4
+ import { reporter as testReportingReporter } from 'd2l-test-reporting/reporters/web-test-runner.js';
4
5
  import { visualDiff } from './visual-diff-plugin.js';
5
6
  import { visualDiffReporter } from './visual-diff-reporter.js';
6
7
 
@@ -181,6 +182,7 @@ export class WTRConfig {
181
182
  pattern = DEFAULT_PATTERN,
182
183
  slow,
183
184
  timeout,
185
+ testReporting,
184
186
  ...passthroughConfig
185
187
  } = {}) {
186
188
 
@@ -213,6 +215,12 @@ export class WTRConfig {
213
215
  });
214
216
  }
215
217
 
218
+ testReporting = !!testReporting || this.#cliArgs['test-reporting'];
219
+
220
+ if (group === 'vdiff' || testReporting) {
221
+ config.reporters ??= [ defaultReporter() ];
222
+ }
223
+
216
224
  if (group === 'test') {
217
225
  config.groups.push({
218
226
  name: 'test',
@@ -221,7 +229,6 @@ export class WTRConfig {
221
229
  } else if (group === 'vdiff') {
222
230
  config.testsFinishTimeout = 5 * 60 * 1000;
223
231
 
224
- config.reporters ??= [ defaultReporter() ];
225
232
  config.reporters.push(visualDiffReporter({ updateGoldens: golden }));
226
233
 
227
234
  config.plugins ??= [];
@@ -230,6 +237,10 @@ export class WTRConfig {
230
237
  config.groups.push(this.visualDiffGroup);
231
238
  }
232
239
 
240
+ if (testReporting) {
241
+ config.reporters.push(testReportingReporter());
242
+ }
243
+
233
244
  // convert all browsers to playwright
234
245
  config.groups.forEach(g => g.browsers = this.getBrowsers(g.browsers, g.name === 'vdiff' ? 2 : 1));
235
246