Skip to content

Commit e958422

Browse files
committed
added LOG_SKIP
1 parent e35185e commit e958422

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

ADVANCED_USAGE.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ You can run only run tests in folders with a specific name like:
1717

1818
#### TIMED
1919
You can log the time it takes to run each test like
20-
```FLUG_TIMED=true npm test```
20+
```TIME=true npm test```
2121
Output will look like this:
2222
<pre>
2323
<span style="color: green">success (324ms): name of test</span>
2424
<span style="color: green">success (461ms): name of another test</span>
2525
</pre>
2626

27+
#### LOG_SKIP
28+
You can suppress logging the information about which tests were skipped.
29+
This can be helpful when you are skipping hundreds of tests.
30+
```LOG_SKIP=false npm test```

examples/test.timed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const test = require("../index.js");
22

3-
process.env.FLUG_TIMED = "true";
3+
process.env.TIME = "true";
44

55
test("timed", ({ eq }) => {});

index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const run = async ({ name, cb, caller }) => {
4545
}
4646
const end_time = performance.now();
4747
const test_time = Math.round(end_time - start_time).toLocaleString() + "ms";
48-
const TIMED = ["True", "TRUE", "true", "t", "1", ""].includes(process.env.FLUG_TIMED);
48+
const TIMED = ["True", "TRUE", "true", "t", "1", ""].includes(process.env.TIME);
4949
if (env === "browser") {
5050
console.log("%c success" + (TIMED ? " (" + test_time + ")" : "") + ": " + name, "color: green");
5151
} else {
@@ -110,10 +110,12 @@ const run = async ({ name, cb, caller }) => {
110110
};
111111

112112
const skip = name => {
113-
if (env === "browser") {
114-
console.log("%c skipped: " + name, "color: rgb(200, 200, 0)");
115-
} else {
116-
console.log(COLORS.YELLOW + "skipped: " + name + COLORS.OFF);
113+
if (!["false", "False", "FALSE", "0"].includes(process.env.LOG_SKIP)) {
114+
if (env === "browser") {
115+
console.log("%c skipped: " + name, "color: rgb(200, 200, 0)");
116+
} else {
117+
console.log(COLORS.YELLOW + "skipped: " + name + COLORS.OFF);
118+
}
117119
}
118120
};
119121

0 commit comments

Comments
 (0)