@brightspace-ui/testing 1.17.0 → 1.19.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.19.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",
@@ -120,7 +120,7 @@ async function getTestRunnerOptions(argv = []) {
120
120
  type: Boolean,
121
121
  description: 'Run tests in Webkit',
122
122
  order: 4
123
- },
123
+ }
124
124
  ];
125
125
 
126
126
  const cliArgs = commandLineArgs(optionDefinitions, { partial: true, argv });
@@ -1,10 +1,13 @@
1
1
  import { defaultReporter } from '@web/test-runner';
2
+ import { env } from 'node:process';
2
3
  import { headedMode } from './headed-mode-plugin.js';
3
4
  import { playwrightLauncher } from '@web/test-runner-playwright';
5
+ import { reporter as testReportingReporter } from 'd2l-test-reporting/reporters/web-test-runner.js';
4
6
  import { visualDiff } from './visual-diff-plugin.js';
5
7
  import { visualDiffReporter } from './visual-diff-reporter.js';
6
8
 
7
9
  const DEFAULT_PATTERN = type => `./test/**/*.${type}.js`;
10
+ const DEFAULT_TEST_REPORTING = !!env['CI'];
8
11
  const BROWSER_MAP = {
9
12
  chrome: 'chromium',
10
13
  chromium: 'chromium',
@@ -181,6 +184,7 @@ export class WTRConfig {
181
184
  pattern = DEFAULT_PATTERN,
182
185
  slow,
183
186
  timeout,
187
+ testReporting = DEFAULT_TEST_REPORTING,
184
188
  ...passthroughConfig
185
189
  } = {}) {
186
190
 
@@ -213,6 +217,10 @@ export class WTRConfig {
213
217
  });
214
218
  }
215
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