browser-ava 1.3.1 → 1.3.3

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-ava",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,16 +35,16 @@
35
35
  "koa": "^2.13.4",
36
36
  "koa-static": "^5.0.0",
37
37
  "playwright": "^1.27.1",
38
- "ws": "^8.10.0"
38
+ "ws": "^8.11.0"
39
39
  },
40
40
  "devDependencies": {
41
- "ava": "^5.0.1",
41
+ "ava": "^5.1.0",
42
42
  "c8": "^7.12.0",
43
43
  "execa": "^6.1.0",
44
44
  "semantic-release": "^19.0.5"
45
45
  },
46
46
  "engines": {
47
- "node": ">=16.18.0"
47
+ "node": ">=16.18.1"
48
48
  },
49
49
  "repository": {
50
50
  "type": "git",
@@ -1,5 +1,11 @@
1
1
  import { testModules } from "./ava.mjs";
2
- import { calculateSummary, summaryMessages, pluralize, stringify } from "./util.mjs";
2
+ import {
3
+ calculateSummary,
4
+ summaryMessages,
5
+ pluralize,
6
+ stringify,
7
+ moduleName
8
+ } from "./util.mjs";
3
9
  import { isEqual } from "./eql.mjs";
4
10
 
5
11
  let ws = new WebSocket(`ws://${location.host}`);
@@ -80,10 +86,10 @@ async function displayTests() {
80
86
  function renderModule(tm) {
81
87
  const passedTestsCount = tm.tests.filter(t => t.passed).length;
82
88
  const allTestsCount = tm.tests.length;
83
- return `<li id="${tm.file}" class="module${
89
+ return `<li id="${moduleName(tm.file)}" class="module${
84
90
  passedTestsCount === allTestsCount ? " passed" : ""
85
91
  }">
86
- <span class="moduleName">${tm.file}</span>
92
+ <span class="moduleName">${moduleName(tm.file)}</span>
87
93
  <span class="moduleSummary"> ( ${passedTestsCount} / ${allTestsCount} ${pluralize(
88
94
  "test",
89
95
  allTestsCount
@@ -171,8 +177,7 @@ async function runTest(parent, tm, test) {
171
177
  } catch (e) {
172
178
  test.passed = false;
173
179
  test.message = e;
174
- }
175
- finally {
180
+ } finally {
176
181
  ws.send(stringify({ action: "update", data: test }));
177
182
  }
178
183
  }
@@ -77,3 +77,7 @@ export function stringify(...args) {
77
77
  BigInt.prototype.toJSON = former;
78
78
  return string;
79
79
  }
80
+
81
+ export function moduleName(url) {
82
+ return url.replace(/\.m?js$/,'')
83
+ }
@@ -95,18 +95,18 @@ program
95
95
  let errors = 0;
96
96
 
97
97
  wss.on("connection", ws => {
98
- ws.on("message", async data => {
99
- data = JSON.parse(data);
100
- switch (data.action) {
98
+ ws.on("message", async content => {
99
+ const { action, data } = JSON.parse(content);
100
+ switch (action) {
101
101
  case "info":
102
- console.info(...data.data);
102
+ console.info(...data);
103
103
  break;
104
104
  case "log":
105
- console.log(...data.data);
105
+ console.log(...data);
106
106
  break;
107
107
  case "error":
108
108
  errors++;
109
- console.error(...data.data);
109
+ console.error(...data);
110
110
  await shutdown(undefined, true);
111
111
  break;
112
112
 
@@ -115,22 +115,23 @@ program
115
115
  break;
116
116
 
117
117
  case "update":
118
- if (data.data.skip) {
119
- console.log(" ", chalk.yellow("- [skip] " + data.data.title));
118
+ if (data.skip) {
119
+ console.log(" ", chalk.yellow("- [skip] " + data.title));
120
120
  } else {
121
- if (data.data.todo) {
121
+ if (data.todo) {
122
122
  } else {
123
- if (data.data.passed === true) {
124
- console.log(" ", chalk.green("✔"), data.data.title);
123
+ if (data.passed === true) {
124
+ console.log( " ", chalk.green("✔"), data.title);
125
125
  } else {
126
- console.log(" ", chalk.red("✘ [fail]: "), data.data.title);
126
+ console.log(" ", chalk.red("✘ [fail]: "), data.title);
127
127
  }
128
128
  }
129
129
  }
130
130
  break;
131
131
 
132
132
  case "result":
133
- const summary = calculateSummary(data.data);
133
+ console.log(" ─\n");
134
+ const summary = calculateSummary(data);
134
135
 
135
136
  const classToColor = {
136
137
  failed: "red",