tape-six 1.1.2 → 1.2.0
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 +1 -0
- package/bin/tape6-bun.js +5 -1
- package/bin/tape6-deno.js +5 -1
- package/package.json +2 -2
- package/src/JSONLReporter.js +10 -1
- package/src/utils/config.js +10 -6
package/README.md
CHANGED
|
@@ -236,6 +236,7 @@ See [set-up tests](https://github.com/uhop/tape-six/wiki/Set-up-tests) for detai
|
|
|
236
236
|
|
|
237
237
|
The most recent releases:
|
|
238
238
|
|
|
239
|
+
- 1.2.0 _Updated dependencies + added an optional prefix for JSON lines._
|
|
239
240
|
- 1.1.2 _Updated dependencies._
|
|
240
241
|
- 1.1.1 _Technical re-release with the missing `index.d.ts` file._
|
|
241
242
|
- 1.1.0 _Added TypeScript support._
|
package/bin/tape6-bun.js
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import {fileURLToPath} from 'node:url';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
resolveTests,
|
|
7
|
+
resolvePatterns,
|
|
8
|
+
getReporter as getReporterType
|
|
9
|
+
} from '../src/utils/config.js';
|
|
6
10
|
|
|
7
11
|
import {getReporter, setReporter} from '../src/test.js';
|
|
8
12
|
import State, {StopTest} from '../src/State.js';
|
package/bin/tape6-deno.js
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import {fileURLToPath} from 'node:url';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
resolveTests,
|
|
7
|
+
resolvePatterns,
|
|
8
|
+
getReporter as getReporterType
|
|
9
|
+
} from '../src/utils/config.js';
|
|
6
10
|
|
|
7
11
|
import {getReporter, setReporter} from '../src/test.js';
|
|
8
12
|
import State, {StopTest} from '../src/State.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tape-six",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "TAP the test harness for the modern JavaScript (ES6).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@types/node": "^25.0.
|
|
74
|
+
"@types/node": "^25.0.5",
|
|
75
75
|
"puppeteer": "^24.34.0",
|
|
76
76
|
"typescript": "^5.9.3"
|
|
77
77
|
}
|
package/src/JSONLReporter.js
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
import {getEnv} from './utils/config.js';
|
|
2
|
+
|
|
1
3
|
class JSONLReporter {
|
|
2
4
|
constructor({renumberAsserts = false} = {}) {
|
|
3
5
|
this.renumberAsserts = renumberAsserts;
|
|
4
6
|
this.assertCounter = 0;
|
|
7
|
+
|
|
8
|
+
const env = getEnv({});
|
|
9
|
+
this.prefix = env.TAPE6_JSONL_PREFIX || '';
|
|
5
10
|
}
|
|
6
11
|
report(event) {
|
|
7
12
|
if (event.type === 'assert' && this.renumberAsserts) {
|
|
8
13
|
event = {...event, id: ++this.assertCounter};
|
|
9
14
|
}
|
|
10
|
-
|
|
15
|
+
if (this.prefix) {
|
|
16
|
+
console.log('\n' + this.prefix + JSON.stringify(event));
|
|
17
|
+
} else {
|
|
18
|
+
console.log(JSON.stringify(event));
|
|
19
|
+
}
|
|
11
20
|
}
|
|
12
21
|
}
|
|
13
22
|
|
package/src/utils/config.js
CHANGED
|
@@ -80,16 +80,20 @@ if (typeof Deno == 'object' && Deno?.version) {
|
|
|
80
80
|
runtime.name = 'browser';
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
export const getEnv = (defaultEnv = null) => runtime.env || defaultEnv;
|
|
84
|
+
|
|
83
85
|
export const getReporter = () => {
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
if (
|
|
87
|
-
if (
|
|
86
|
+
const env = getEnv();
|
|
87
|
+
if (!env) return null;
|
|
88
|
+
if (env.TAPE6_REPORTER) return env.TAPE6_REPORTER;
|
|
89
|
+
if (env.TAPE6_JSONL) return 'jsonl';
|
|
90
|
+
if (env.TAPE6_TAP) return 'tap';
|
|
88
91
|
return 'tty';
|
|
89
92
|
};
|
|
90
93
|
|
|
91
94
|
export const getRunner = () => {
|
|
92
|
-
|
|
93
|
-
if (
|
|
95
|
+
const env = getEnv();
|
|
96
|
+
if (!env) return null;
|
|
97
|
+
if (env.TAPE6_RUNNER) return env.TAPE6_RUNNER;
|
|
94
98
|
return 'thread';
|
|
95
99
|
};
|