browser-ava 1.3.2 → 1.3.4
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 +2 -2
- package/src/browser/runtime.mjs +10 -5
- package/src/browser/util.mjs +4 -0
- package/src/browser-ava-cli.mjs +13 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browser-ava",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"ws": "^8.11.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"ava": "^5.0
|
|
41
|
+
"ava": "^5.1.0",
|
|
42
42
|
"c8": "^7.12.0",
|
|
43
43
|
"execa": "^6.1.0",
|
|
44
44
|
"semantic-release": "^19.0.5"
|
package/src/browser/runtime.mjs
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { testModules } from "./ava.mjs";
|
|
2
|
-
import {
|
|
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
|
}
|
package/src/browser/util.mjs
CHANGED
package/src/browser-ava-cli.mjs
CHANGED
|
@@ -95,18 +95,18 @@ program
|
|
|
95
95
|
let errors = 0;
|
|
96
96
|
|
|
97
97
|
wss.on("connection", ws => {
|
|
98
|
-
ws.on("message", async
|
|
99
|
-
data = JSON.parse(
|
|
100
|
-
switch (
|
|
98
|
+
ws.on("message", async content => {
|
|
99
|
+
const { action, data } = JSON.parse(content);
|
|
100
|
+
switch (action) {
|
|
101
101
|
case "info":
|
|
102
|
-
console.info(...data
|
|
102
|
+
console.info(...data);
|
|
103
103
|
break;
|
|
104
104
|
case "log":
|
|
105
|
-
console.log(...data
|
|
105
|
+
console.log(...data);
|
|
106
106
|
break;
|
|
107
107
|
case "error":
|
|
108
108
|
errors++;
|
|
109
|
-
console.error(...data
|
|
109
|
+
console.error(...data);
|
|
110
110
|
await shutdown(undefined, true);
|
|
111
111
|
break;
|
|
112
112
|
|
|
@@ -115,15 +115,15 @@ program
|
|
|
115
115
|
break;
|
|
116
116
|
|
|
117
117
|
case "update":
|
|
118
|
-
if (data.
|
|
119
|
-
console.log(" ", chalk.yellow("- [skip] " + data.
|
|
118
|
+
if (data.skip) {
|
|
119
|
+
console.log(" ", chalk.yellow("- [skip] " + data.title));
|
|
120
120
|
} else {
|
|
121
|
-
if (data.
|
|
121
|
+
if (data.todo) {
|
|
122
122
|
} else {
|
|
123
|
-
if (data.
|
|
124
|
-
console.log(" ", chalk.green("✔"), data.
|
|
123
|
+
if (data.passed === true) {
|
|
124
|
+
console.log( " ", chalk.green("✔"), data.title);
|
|
125
125
|
} else {
|
|
126
|
-
console.log(" ", chalk.red("✘ [fail]: "), data.
|
|
126
|
+
console.log(" ", chalk.red("✘ [fail]: "), data.title);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
@@ -131,7 +131,7 @@ program
|
|
|
131
131
|
|
|
132
132
|
case "result":
|
|
133
133
|
console.log(" ─\n");
|
|
134
|
-
const summary = calculateSummary(data
|
|
134
|
+
const summary = calculateSummary(data);
|
|
135
135
|
|
|
136
136
|
const classToColor = {
|
|
137
137
|
failed: "red",
|