browser-ava 1.0.2 → 1.0.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 +1 -1
- package/src/browser/util.mjs +7 -0
- package/src/browser-ava-cli.mjs +9 -1
package/package.json
CHANGED
package/src/browser/util.mjs
CHANGED
|
@@ -32,9 +32,16 @@ export function calculateSummary(testModules) {
|
|
|
32
32
|
return { passed, failed, knownFailure, skip, todo };
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Pluralize subjects
|
|
37
|
+
* @param {string} word subject to be pluralized
|
|
38
|
+
* @param {number} number if > 1 pluralize otherwize keep subject alone
|
|
39
|
+
* @returns {string} pluralized subject if number > 1
|
|
40
|
+
*/
|
|
35
41
|
export function pluralize(word, number) {
|
|
36
42
|
return number > 1 ? word + "s" : word;
|
|
37
43
|
}
|
|
44
|
+
|
|
38
45
|
export function summaryMessages(summary) {
|
|
39
46
|
const messages = [];
|
|
40
47
|
|
package/src/browser-ava-cli.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import { program, Option } from "commander";
|
|
|
11
11
|
import { calculateSummary, summaryMessages } from "./browser/util.mjs";
|
|
12
12
|
import { resolveImport } from "./resolver.mjs";
|
|
13
13
|
import { globby } from "globby";
|
|
14
|
+
import chalk from "chalk";
|
|
14
15
|
|
|
15
16
|
const utf8EncodingOptions = { encoding: "utf8" };
|
|
16
17
|
|
|
@@ -107,8 +108,15 @@ program
|
|
|
107
108
|
case "result":
|
|
108
109
|
const summary = calculateSummary(data.data);
|
|
109
110
|
|
|
111
|
+
const classToColor = {
|
|
112
|
+
failed: "red",
|
|
113
|
+
passed: "green",
|
|
114
|
+
todo: "blue",
|
|
115
|
+
skip: "yellow"
|
|
116
|
+
};
|
|
117
|
+
|
|
110
118
|
for (const m of summaryMessages(summary)) {
|
|
111
|
-
console.log(m.text);
|
|
119
|
+
console.log(" " + chalk[classToColor[m.colorClass] || "black"](m.text));
|
|
112
120
|
}
|
|
113
121
|
|
|
114
122
|
await shutdown(summary.failed);
|