@brightspace-ui/testing 0.27.2 → 0.28.1

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/README.md CHANGED
@@ -351,7 +351,7 @@ TODO: note about leveraging @web/test-runner
351
351
 
352
352
  TODO
353
353
 
354
- ## Developing & Contributing
354
+ ## Developing and Contributing
355
355
 
356
356
  After cloning the repo, run `npm install` to install its dependencies.
357
357
 
@@ -363,7 +363,7 @@ To run the full suite of tests:
363
363
  npm test
364
364
  ```
365
365
 
366
- Alternately, tests can be selectively run:
366
+ Alternatively, tests can be selectively run:
367
367
 
368
368
  ```shell
369
369
  # binary unit tests
@@ -379,7 +379,7 @@ npm run test:server
379
379
  npm run test:vdiff
380
380
  ```
381
381
 
382
- ### Versioning & Releasing
382
+ ### Versioning and Releasing
383
383
 
384
384
  This repo is configured to use `semantic-release`. Commits prefixed with `fix:` and `feat:` will trigger patch and minor releases when merged to `main`.
385
385
 
@@ -29,6 +29,7 @@ if (cli.subcommand === 'vdiff') {
29
29
  }
30
30
 
31
31
  async function runTests() {
32
+ runner.install();
32
33
  const options = await runner.getOptions(argv);
33
34
  await runner.start(options);
34
35
  }
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": "0.27.2",
5
+ "version": "0.28.1",
6
6
  "repository": "https://github.com/BrightspaceUI/testing.git",
7
7
  "scripts": {
8
8
  "lint": "eslint . --ext .js",
@@ -2,6 +2,7 @@ import { ConfigLoaderError, readConfig } from '@web/config-loader';
2
2
  import { DEFAULT_VDIFF_SLOW, WTRConfig } from '../wtr-config.js';
3
3
  import commandLineArgs from 'command-line-args';
4
4
  import commandLineUsage from 'command-line-usage';
5
+ import { execSync } from 'node:child_process';
5
6
  import process from 'node:process';
6
7
  import { startTestRunner } from '@web/test-runner';
7
8
 
@@ -196,7 +197,12 @@ async function getTestRunnerOptions(argv = []) {
196
197
  };
197
198
  }
198
199
 
200
+ function installDeps() {
201
+ execSync('npx playwright install-deps', { stdio: 'pipe' });
202
+ }
203
+
199
204
  export const runner = {
200
205
  getOptions: getTestRunnerOptions,
206
+ install: installDeps,
201
207
  start: startTestRunner
202
208
  };
@@ -195,11 +195,14 @@ export function renderBrowserResults(browser, tests, options) {
195
195
  return acc;
196
196
  }
197
197
 
198
- let status = STATUS_TYPE.WARNING;
199
- if (resultData.duration > resultData.info.slowDuration) {
200
- status = STATUS_TYPE.ERROR;
201
- } else if (resultData.duration < (resultData.info.slowDuration / 2)) {
202
- status = STATUS_TYPE.NORMAL;
198
+ let status = STATUS_TYPE.NORMAL;
199
+ if (resultData.info) {
200
+ status = STATUS_TYPE.WARNING;
201
+ if (resultData.duration > resultData.info.slowDuration) {
202
+ status = STATUS_TYPE.ERROR;
203
+ } else if (resultData.duration < (resultData.info.slowDuration / 2)) {
204
+ status = STATUS_TYPE.NORMAL;
205
+ }
203
206
  }
204
207
 
205
208
  return acc.push(html`
@@ -70,6 +70,11 @@ function flattenResults(session, browserData, fileData) {
70
70
  tests.forEach(t => {
71
71
  const testName = `${prefix}${t.name}`;
72
72
  const testKey = testName.replaceAll(' > ', ' ');
73
+ const info = getTestInfo(session, testKey);
74
+
75
+ // tests missing info but with no error were skipped via grep, so exclude them
76
+ if (!info && !t.error) return;
77
+
73
78
  if (!fileData.tests.has(testName)) {
74
79
  fileData.tests.set(testName, {
75
80
  name: testName,
@@ -87,7 +92,7 @@ function flattenResults(session, browserData, fileData) {
87
92
  duration: t.duration,
88
93
  error: t.error?.message,
89
94
  passed: t.passed,
90
- info: getTestInfo(session, testKey)
95
+ info: info
91
96
  });
92
97
  });
93
98
  }