tape-six 1.7.3 → 1.7.5
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 +2 -0
- package/TESTING.md +1 -0
- package/bin/tape6-bun.js +23 -98
- package/bin/tape6-deno.js +23 -99
- package/bin/tape6-node.js +20 -112
- package/bin/tape6-seq.js +26 -81
- package/bin/tape6-server.js +6 -0
- package/index.js +2 -2
- package/llms-full.txt +2 -1
- package/package.json +2 -2
- package/src/State.js +3 -2
- package/src/reporters/JSONLReporter.js +2 -2
- package/src/reporters/MinReporter.js +2 -2
- package/src/reporters/ProxyReporter.js +2 -2
- package/src/reporters/Reporter.js +2 -2
- package/src/reporters/TTYReporter.js +6 -6
- package/src/reporters/TapReporter.js +2 -1
- package/src/runners/bun/TestWorker.js +21 -34
- package/src/runners/deno/TestWorker.js +11 -20
- package/src/runners/node/TestWorker.js +21 -34
- package/src/runners/seq/BypassReporter.js +2 -2
- package/src/runners/seq/TestWorker.js +18 -31
- package/src/utils/EventServer.js +4 -4
- package/src/utils/config.js +186 -0
- package/web-app/DashReporter.js +2 -2
- package/web-app/DomReporter.js +2 -2
- package/web-app/favicon.ico +0 -0
- package/web-app/favicon.png +0 -0
- package/web-app/index.html +2 -0
package/README.md
CHANGED
|
@@ -420,6 +420,8 @@ Test output can be controlled by flags. See [Supported flags](https://github.com
|
|
|
420
420
|
|
|
421
421
|
The most recent releases:
|
|
422
422
|
|
|
423
|
+
- 1.7.5 _Refactored CLI runners, added `--info` option, renamed `dontCaptureConsole` to `noConsoleCapture`._
|
|
424
|
+
- 1.7.4 _Bug fixes: uncaught exception handling, `StopTest` suppression in parallel runners._
|
|
423
425
|
- 1.7.3 _Bug fixes in reporters, runners, and assertions. Documentation corrections and improvements._
|
|
424
426
|
- 1.7.2 _Minor internal refactoring and fixes._
|
|
425
427
|
- 1.7.1 _Added AI support, added timeout to start test runners, fixed some bugs in the sequential test runner._
|
package/TESTING.md
CHANGED
|
@@ -464,6 +464,7 @@ deno run -A tests/test-example.js # Deno
|
|
|
464
464
|
npx tape6 --flags FO # parallel (worker threads)
|
|
465
465
|
npx tape6-seq --flags FO # sequential (in-process, no workers)
|
|
466
466
|
npx tape6 --par 4 --flags FO # limit to 4 workers
|
|
467
|
+
npx tape6 --info --flags FO # show config and exit without running tests
|
|
467
468
|
```
|
|
468
469
|
|
|
469
470
|
**`tape6` vs `tape6-seq`**: The default `tape6` runner spawns worker threads to run test files in parallel — faster, but each file runs in its own isolated context. `tape6-seq` runs all test files sequentially in a single process — slower, but useful for debugging, for tests that share state, or when worker threads are unavailable.
|
package/bin/tape6-bun.js
CHANGED
|
@@ -2,24 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import {fileURLToPath} from 'node:url';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
resolveTests,
|
|
7
|
-
resolvePatterns,
|
|
8
|
-
getReporterFileName,
|
|
9
|
-
getReporterType
|
|
10
|
-
} from '../src/utils/config.js';
|
|
5
|
+
import {getOptions, initFiles, initReporter, showInfo} from '../src/utils/config.js';
|
|
11
6
|
|
|
12
7
|
import {getReporter, setReporter} from '../src/test.js';
|
|
13
8
|
import {selectTimer} from '../src/utils/timer.js';
|
|
14
9
|
|
|
15
10
|
import TestWorker from '../src/runners/bun/TestWorker.js';
|
|
16
11
|
|
|
17
|
-
const
|
|
18
|
-
rootFolder = Bun.cwd;
|
|
19
|
-
|
|
20
|
-
let flags = '',
|
|
21
|
-
parallel = '',
|
|
22
|
-
files = [];
|
|
12
|
+
const rootFolder = Bun.cwd;
|
|
23
13
|
|
|
24
14
|
const showSelf = () => {
|
|
25
15
|
const self = new URL(import.meta.url);
|
|
@@ -31,100 +21,35 @@ const showSelf = () => {
|
|
|
31
21
|
process.exit(0);
|
|
32
22
|
};
|
|
33
23
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
t: 'showTime',
|
|
40
|
-
b: 'showBanner',
|
|
41
|
-
d: 'showData',
|
|
42
|
-
o: 'failOnce',
|
|
43
|
-
n: 'showAssertNumber',
|
|
44
|
-
m: 'monochrome',
|
|
45
|
-
c: 'dontCaptureConsole',
|
|
46
|
-
h: 'hideStreams'
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
let parIsSet = false;
|
|
50
|
-
|
|
51
|
-
for (let i = 2; i < Bun.argv.length; ++i) {
|
|
52
|
-
const arg = Bun.argv[i];
|
|
53
|
-
if (arg == '-f' || arg == '--flags') {
|
|
54
|
-
if (++i < Bun.argv.length) {
|
|
55
|
-
flags += Bun.argv[i];
|
|
56
|
-
}
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
if (arg == '-p' || arg == '--par') {
|
|
60
|
-
if (++i < Bun.argv.length) {
|
|
61
|
-
parallel = Bun.argv[i];
|
|
62
|
-
parIsSet = true;
|
|
63
|
-
if (!parallel || isNaN(parallel)) {
|
|
64
|
-
parallel = '';
|
|
65
|
-
parIsSet = false;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
files.push(arg);
|
|
71
|
-
}
|
|
24
|
+
const main = async () => {
|
|
25
|
+
const currentOptions = getOptions({
|
|
26
|
+
'--self': showSelf,
|
|
27
|
+
'--info': {isValueRequired: false}
|
|
28
|
+
});
|
|
72
29
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
options.flags = flags;
|
|
30
|
+
const [files] = await Promise.all([
|
|
31
|
+
initFiles(currentOptions.files, rootFolder),
|
|
32
|
+
initReporter(getReporter, setReporter, currentOptions.flags),
|
|
33
|
+
selectTimer()
|
|
34
|
+
]);
|
|
80
35
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
parallel = Math.max(0, +parallel);
|
|
86
|
-
if (parallel === Infinity) parallel = 0;
|
|
87
|
-
} else {
|
|
88
|
-
parallel = 0;
|
|
89
|
-
}
|
|
90
|
-
if (!parallel) parallel = globalThis.navigator?.hardwareConcurrency || 1;
|
|
91
|
-
};
|
|
36
|
+
process.on('uncaughtException', (error, origin) => {
|
|
37
|
+
console.error('UNHANDLED ERROR:', origin, error);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
});
|
|
92
40
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const reporterType = getReporterType(),
|
|
97
|
-
reporterFile = getReporterFileName(reporterType),
|
|
98
|
-
CustomReporter = (await import('../src/reporters/' + reporterFile)).default,
|
|
99
|
-
hasColors = !(
|
|
100
|
-
options.monochrome ||
|
|
101
|
-
Bun.env.NO_COLOR ||
|
|
102
|
-
Bun.env.NODE_DISABLE_COLORS ||
|
|
103
|
-
Bun.env.FORCE_COLOR === '0'
|
|
104
|
-
),
|
|
105
|
-
customOptions = reporterType === 'tap' ? {useJson: true, hasColors} : {...options, hasColors},
|
|
106
|
-
customReporter = new CustomReporter(customOptions);
|
|
107
|
-
setReporter(customReporter);
|
|
41
|
+
if (currentOptions.optionFlags['--info'] === '') {
|
|
42
|
+
showInfo(currentOptions, files);
|
|
43
|
+
process.exit(0);
|
|
108
44
|
}
|
|
109
45
|
|
|
110
|
-
if (files.length) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
files = await resolveTests(rootFolder, 'bun');
|
|
46
|
+
if (!files.length) {
|
|
47
|
+
console.log('No files found.');
|
|
48
|
+
process.exit(1);
|
|
114
49
|
}
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const main = async () => {
|
|
118
|
-
config();
|
|
119
|
-
await init();
|
|
120
|
-
await selectTimer();
|
|
121
|
-
|
|
122
|
-
process.on('uncaughtException', (error, origin) =>
|
|
123
|
-
console.error('UNHANDLED ERROR:', origin, error)
|
|
124
|
-
);
|
|
125
50
|
|
|
126
51
|
const reporter = getReporter(),
|
|
127
|
-
worker = new TestWorker(reporter, parallel,
|
|
52
|
+
worker = new TestWorker(reporter, currentOptions.parallel, currentOptions.flags);
|
|
128
53
|
|
|
129
54
|
reporter.report({type: 'test', test: 0});
|
|
130
55
|
|
package/bin/tape6-deno.js
CHANGED
|
@@ -2,24 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import {fileURLToPath} from 'node:url';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
resolveTests,
|
|
7
|
-
resolvePatterns,
|
|
8
|
-
getReporterFileName,
|
|
9
|
-
getReporterType
|
|
10
|
-
} from '../src/utils/config.js';
|
|
5
|
+
import {getOptions, initFiles, initReporter, showInfo} from '../src/utils/config.js';
|
|
11
6
|
|
|
12
7
|
import {getReporter, setReporter} from '../src/test.js';
|
|
13
8
|
import {selectTimer} from '../src/utils/timer.js';
|
|
14
9
|
|
|
15
10
|
import TestWorker from '../src/runners/deno/TestWorker.js';
|
|
16
11
|
|
|
17
|
-
const
|
|
18
|
-
rootFolder = Deno.cwd();
|
|
19
|
-
|
|
20
|
-
let flags = '',
|
|
21
|
-
parallel = '',
|
|
22
|
-
files = [];
|
|
12
|
+
const rootFolder = Deno.cwd();
|
|
23
13
|
|
|
24
14
|
const showSelf = () => {
|
|
25
15
|
const self = new URL(import.meta.url);
|
|
@@ -31,101 +21,35 @@ const showSelf = () => {
|
|
|
31
21
|
Deno.exit(0);
|
|
32
22
|
};
|
|
33
23
|
|
|
34
|
-
const config = () => {
|
|
35
|
-
if (Deno.args.includes('--self')) showSelf();
|
|
36
|
-
|
|
37
|
-
const optionNames = {
|
|
38
|
-
f: 'failureOnly',
|
|
39
|
-
t: 'showTime',
|
|
40
|
-
b: 'showBanner',
|
|
41
|
-
d: 'showData',
|
|
42
|
-
o: 'failOnce',
|
|
43
|
-
n: 'showAssertNumber',
|
|
44
|
-
m: 'monochrome',
|
|
45
|
-
c: 'dontCaptureConsole',
|
|
46
|
-
h: 'hideStreams'
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
let parIsSet = false;
|
|
50
|
-
|
|
51
|
-
for (let i = 0; i < Deno.args.length; ++i) {
|
|
52
|
-
const arg = Deno.args[i];
|
|
53
|
-
if (arg == '-f' || arg == '--flags') {
|
|
54
|
-
if (++i < Deno.args.length) {
|
|
55
|
-
flags += Deno.args[i];
|
|
56
|
-
}
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
if (arg == '-p' || arg == '--par') {
|
|
60
|
-
if (++i < Deno.args.length) {
|
|
61
|
-
parallel = Deno.args[i];
|
|
62
|
-
parIsSet = true;
|
|
63
|
-
if (!parallel || isNaN(parallel)) {
|
|
64
|
-
parallel = '';
|
|
65
|
-
parIsSet = false;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
files.push(arg);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
flags = (Deno.env.get('TAPE6_FLAGS') || '') + flags;
|
|
74
|
-
for (let i = 0; i < flags.length; ++i) {
|
|
75
|
-
const option = flags[i].toLowerCase(),
|
|
76
|
-
name = optionNames[option];
|
|
77
|
-
if (typeof name == 'string') options[name] = option !== flags[i];
|
|
78
|
-
}
|
|
79
|
-
options.flags = flags;
|
|
80
|
-
|
|
81
|
-
if (!parIsSet) {
|
|
82
|
-
parallel = Deno.env.get('TAPE6_PAR') || parallel;
|
|
83
|
-
}
|
|
84
|
-
if (parallel) {
|
|
85
|
-
parallel = Math.max(0, +parallel);
|
|
86
|
-
if (parallel === Infinity) parallel = 0;
|
|
87
|
-
} else {
|
|
88
|
-
parallel = 0;
|
|
89
|
-
}
|
|
90
|
-
if (!parallel) parallel = globalThis.navigator?.hardwareConcurrency || 1;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const init = async () => {
|
|
94
|
-
const currentReporter = getReporter();
|
|
95
|
-
if (!currentReporter) {
|
|
96
|
-
const reporterType = getReporterType(),
|
|
97
|
-
reporterFile = getReporterFileName(reporterType),
|
|
98
|
-
CustomReporter = (await import('../src/reporters/' + reporterFile)).default,
|
|
99
|
-
hasColors = !(
|
|
100
|
-
options.monochrome ||
|
|
101
|
-
Deno.env.get('NO_COLOR') ||
|
|
102
|
-
Deno.env.get('NODE_DISABLE_COLORS') ||
|
|
103
|
-
Deno.env.get('FORCE_COLOR') === '0'
|
|
104
|
-
),
|
|
105
|
-
customOptions = reporterType === 'tap' ? {useJson: true, hasColors} : {...options, hasColors},
|
|
106
|
-
customReporter = new CustomReporter(customOptions);
|
|
107
|
-
setReporter(customReporter);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (files.length) {
|
|
111
|
-
files = await resolvePatterns(rootFolder, files);
|
|
112
|
-
} else {
|
|
113
|
-
files = await resolveTests(rootFolder, 'deno');
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
|
|
117
24
|
const main = async () => {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
25
|
+
const currentOptions = getOptions({
|
|
26
|
+
'--self': showSelf,
|
|
27
|
+
'--info': {isValueRequired: false}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const [files] = await Promise.all([
|
|
31
|
+
initFiles(currentOptions.files, rootFolder),
|
|
32
|
+
initReporter(getReporter, setReporter, currentOptions.flags),
|
|
33
|
+
selectTimer()
|
|
34
|
+
]);
|
|
121
35
|
|
|
122
36
|
addEventListener('error', event => {
|
|
123
37
|
console.log('UNHANDLED ERROR:', event.message);
|
|
124
38
|
event.preventDefault();
|
|
125
39
|
});
|
|
126
40
|
|
|
41
|
+
if (currentOptions.optionFlags['--info'] === '') {
|
|
42
|
+
showInfo(currentOptions, files);
|
|
43
|
+
Deno.exit(0);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!files.length) {
|
|
47
|
+
console.log('No files found.');
|
|
48
|
+
Deno.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
127
51
|
const reporter = getReporter(),
|
|
128
|
-
worker = new TestWorker(reporter, parallel,
|
|
52
|
+
worker = new TestWorker(reporter, currentOptions.parallel, currentOptions.flags);
|
|
129
53
|
|
|
130
54
|
reporter.report({type: 'test', test: 0});
|
|
131
55
|
|
package/bin/tape6-node.js
CHANGED
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import process from 'node:process';
|
|
4
|
-
import os from 'node:os';
|
|
5
4
|
import {fileURLToPath} from 'node:url';
|
|
6
5
|
|
|
7
|
-
import {
|
|
8
|
-
resolveTests,
|
|
9
|
-
resolvePatterns,
|
|
10
|
-
getReporterFileName,
|
|
11
|
-
getReporterType
|
|
12
|
-
} from '../src/utils/config.js';
|
|
6
|
+
import {getOptions, initFiles, initReporter, showInfo} from '../src/utils/config.js';
|
|
13
7
|
|
|
14
8
|
import {getReporter, setReporter} from '../src/test.js';
|
|
15
9
|
import {selectTimer} from '../src/utils/timer.js';
|
|
16
10
|
|
|
17
11
|
import TestWorker from '../src/runners/node/TestWorker.js';
|
|
18
12
|
|
|
19
|
-
const
|
|
20
|
-
rootFolder = process.cwd();
|
|
21
|
-
|
|
22
|
-
let flags = '',
|
|
23
|
-
parallel = '',
|
|
24
|
-
files = [];
|
|
13
|
+
const rootFolder = process.cwd();
|
|
25
14
|
|
|
26
15
|
const showSelf = () => {
|
|
27
16
|
const self = new URL(import.meta.url);
|
|
@@ -33,108 +22,27 @@ const showSelf = () => {
|
|
|
33
22
|
process.exit(0);
|
|
34
23
|
};
|
|
35
24
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
t: 'showTime',
|
|
42
|
-
b: 'showBanner',
|
|
43
|
-
d: 'showData',
|
|
44
|
-
o: 'failOnce',
|
|
45
|
-
n: 'showAssertNumber',
|
|
46
|
-
m: 'monochrome',
|
|
47
|
-
c: 'dontCaptureConsole',
|
|
48
|
-
h: 'hideStreams'
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
let parIsSet = false;
|
|
52
|
-
|
|
53
|
-
for (let i = 2; i < process.argv.length; ++i) {
|
|
54
|
-
const arg = process.argv[i];
|
|
55
|
-
if (arg == '-f' || arg == '--flags') {
|
|
56
|
-
if (++i < process.argv.length) {
|
|
57
|
-
flags += process.argv[i];
|
|
58
|
-
}
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
if (arg == '-p' || arg == '--par') {
|
|
62
|
-
if (++i < process.argv.length) {
|
|
63
|
-
parallel = process.argv[i];
|
|
64
|
-
parIsSet = true;
|
|
65
|
-
if (!parallel || isNaN(parallel)) {
|
|
66
|
-
parallel = '';
|
|
67
|
-
parIsSet = false;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
files.push(arg);
|
|
73
|
-
}
|
|
25
|
+
const main = async () => {
|
|
26
|
+
const currentOptions = getOptions({
|
|
27
|
+
'--self': showSelf,
|
|
28
|
+
'--info': {isValueRequired: false}
|
|
29
|
+
});
|
|
74
30
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
options.flags = flags;
|
|
31
|
+
const [files] = await Promise.all([
|
|
32
|
+
initFiles(currentOptions.files, rootFolder),
|
|
33
|
+
initReporter(getReporter, setReporter, currentOptions.flags),
|
|
34
|
+
selectTimer()
|
|
35
|
+
]);
|
|
82
36
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
parallel = Math.max(0, +parallel);
|
|
88
|
-
if (parallel === Infinity) parallel = 0;
|
|
89
|
-
} else {
|
|
90
|
-
parallel = 0;
|
|
91
|
-
}
|
|
92
|
-
if (!parallel) {
|
|
93
|
-
if (typeof navigator !== 'undefined' && navigator.hardwareConcurrency) {
|
|
94
|
-
parallel = navigator.hardwareConcurrency;
|
|
95
|
-
} else {
|
|
96
|
-
try {
|
|
97
|
-
parallel = os.availableParallelism();
|
|
98
|
-
} catch (e) {
|
|
99
|
-
void e;
|
|
100
|
-
parallel = 1;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const init = async () => {
|
|
107
|
-
const currentReporter = getReporter();
|
|
108
|
-
if (!currentReporter) {
|
|
109
|
-
const reporterType = getReporterType(),
|
|
110
|
-
reporterFile = getReporterFileName(reporterType),
|
|
111
|
-
CustomReporter = (await import('../src/reporters/' + reporterFile)).default,
|
|
112
|
-
hasColors = !(
|
|
113
|
-
options.monochrome ||
|
|
114
|
-
process.env.NO_COLOR ||
|
|
115
|
-
process.env.NODE_DISABLE_COLORS ||
|
|
116
|
-
process.env.FORCE_COLOR === '0'
|
|
117
|
-
),
|
|
118
|
-
customOptions = reporterType === 'tap' ? {useJson: true, hasColors} : {...options, hasColors},
|
|
119
|
-
customReporter = new CustomReporter(customOptions);
|
|
120
|
-
setReporter(customReporter);
|
|
121
|
-
}
|
|
37
|
+
process.on('uncaughtException', (error, origin) => {
|
|
38
|
+
console.error('UNHANDLED ERROR:', origin, error);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
});
|
|
122
41
|
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
files = await resolveTests(rootFolder, 'node');
|
|
42
|
+
if (currentOptions.optionFlags['--info'] === '') {
|
|
43
|
+
showInfo(currentOptions, files);
|
|
44
|
+
process.exit(0);
|
|
127
45
|
}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const main = async () => {
|
|
131
|
-
config();
|
|
132
|
-
await init();
|
|
133
|
-
await selectTimer();
|
|
134
|
-
|
|
135
|
-
process.on('uncaughtException', (error, origin) =>
|
|
136
|
-
console.error('UNHANDLED ERROR:', origin, error)
|
|
137
|
-
);
|
|
138
46
|
|
|
139
47
|
if (!files.length) {
|
|
140
48
|
console.log('No files found.');
|
|
@@ -142,7 +50,7 @@ const main = async () => {
|
|
|
142
50
|
}
|
|
143
51
|
|
|
144
52
|
const reporter = getReporter(),
|
|
145
|
-
worker = new TestWorker(reporter, parallel,
|
|
53
|
+
worker = new TestWorker(reporter, currentOptions.parallel, currentOptions.flags);
|
|
146
54
|
|
|
147
55
|
reporter.report({type: 'test', test: 0});
|
|
148
56
|
|
package/bin/tape6-seq.js
CHANGED
|
@@ -3,12 +3,7 @@
|
|
|
3
3
|
import process from 'node:process';
|
|
4
4
|
import {fileURLToPath} from 'node:url';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
resolveTests,
|
|
8
|
-
resolvePatterns,
|
|
9
|
-
getReporterFileName,
|
|
10
|
-
getReporterType
|
|
11
|
-
} from '../src/utils/config.js';
|
|
6
|
+
import {getOptions, initFiles, initReporter, showInfo} from '../src/utils/config.js';
|
|
12
7
|
|
|
13
8
|
import {getReporter, setReporter, setConfiguredFlag, testRunner} from '../src/test.js';
|
|
14
9
|
import {selectTimer} from '../src/utils/timer.js';
|
|
@@ -17,11 +12,7 @@ import TestWorker from '../src/runners/seq/TestWorker.js';
|
|
|
17
12
|
|
|
18
13
|
setConfiguredFlag(true);
|
|
19
14
|
|
|
20
|
-
const
|
|
21
|
-
rootFolder = process.cwd();
|
|
22
|
-
|
|
23
|
-
let flags = '',
|
|
24
|
-
files = [];
|
|
15
|
+
const rootFolder = process.cwd();
|
|
25
16
|
|
|
26
17
|
const showSelf = () => {
|
|
27
18
|
const self = new URL(import.meta.url);
|
|
@@ -33,83 +24,37 @@ const showSelf = () => {
|
|
|
33
24
|
process.exit(0);
|
|
34
25
|
};
|
|
35
26
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
t: 'showTime',
|
|
42
|
-
b: 'showBanner',
|
|
43
|
-
d: 'showData',
|
|
44
|
-
o: 'failOnce',
|
|
45
|
-
n: 'showAssertNumber',
|
|
46
|
-
m: 'monochrome',
|
|
47
|
-
c: 'dontCaptureConsole',
|
|
48
|
-
h: 'hideStreams'
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
for (let i = 2; i < process.argv.length; ++i) {
|
|
52
|
-
const arg = process.argv[i];
|
|
53
|
-
if (arg == '-f' || arg == '--flags') {
|
|
54
|
-
if (++i < process.argv.length) {
|
|
55
|
-
flags += process.argv[i];
|
|
56
|
-
}
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
if (arg == '-p' || arg == '--par') {
|
|
60
|
-
// skip
|
|
61
|
-
++i;
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
files.push(arg);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
flags = (process.env.TAPE6_FLAGS || '') + flags;
|
|
68
|
-
for (let i = 0; i < flags.length; ++i) {
|
|
69
|
-
const option = flags[i].toLowerCase(),
|
|
70
|
-
name = optionNames[option];
|
|
71
|
-
if (typeof name == 'string') options[name] = option !== flags[i];
|
|
72
|
-
}
|
|
73
|
-
options.flags = flags;
|
|
74
|
-
};
|
|
27
|
+
const main = async () => {
|
|
28
|
+
const currentOptions = getOptions({
|
|
29
|
+
'--self': showSelf,
|
|
30
|
+
'--info': {isValueRequired: false}
|
|
31
|
+
});
|
|
75
32
|
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
CustomReporter = (await import('../src/reporters/' + reporterFile)).default,
|
|
82
|
-
hasColors = !(
|
|
83
|
-
options.monochrome ||
|
|
84
|
-
process.env.NO_COLOR ||
|
|
85
|
-
process.env.NODE_DISABLE_COLORS ||
|
|
86
|
-
process.env.FORCE_COLOR === '0'
|
|
87
|
-
),
|
|
88
|
-
customOptions = reporterType === 'tap' ? {useJson: true, hasColors} : {...options, hasColors},
|
|
89
|
-
customReporter = new CustomReporter(customOptions);
|
|
90
|
-
setReporter(customReporter);
|
|
91
|
-
}
|
|
33
|
+
const [files] = await Promise.all([
|
|
34
|
+
initFiles(currentOptions.files, rootFolder),
|
|
35
|
+
initReporter(getReporter, setReporter, currentOptions.flags),
|
|
36
|
+
selectTimer()
|
|
37
|
+
]);
|
|
92
38
|
|
|
93
|
-
|
|
94
|
-
files = await resolvePatterns(rootFolder, files);
|
|
95
|
-
} else {
|
|
96
|
-
files = await resolveTests(rootFolder, 'node');
|
|
97
|
-
}
|
|
98
|
-
};
|
|
39
|
+
const console = globalThis.console;
|
|
99
40
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
41
|
+
process.on('uncaughtException', (error, origin) => {
|
|
42
|
+
console.error('UNHANDLED ERROR:', origin, error);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
});
|
|
104
45
|
|
|
105
|
-
|
|
46
|
+
if (currentOptions.optionFlags['--info'] === '') {
|
|
47
|
+
showInfo(currentOptions, files);
|
|
48
|
+
process.exit(0);
|
|
49
|
+
}
|
|
106
50
|
|
|
107
|
-
|
|
108
|
-
console.
|
|
109
|
-
|
|
51
|
+
if (!files.length) {
|
|
52
|
+
console.log('No files found.');
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
110
55
|
|
|
111
56
|
const reporter = getReporter(),
|
|
112
|
-
worker = new TestWorker(reporter, 1, {...
|
|
57
|
+
worker = new TestWorker(reporter, 1, {...currentOptions.flags, testRunner});
|
|
113
58
|
|
|
114
59
|
reporter.report({type: 'test', test: 0});
|
|
115
60
|
|
package/bin/tape6-server.js
CHANGED
|
@@ -147,6 +147,12 @@ const server = http.createServer(async (req, res) => {
|
|
|
147
147
|
const cfg = await getConfig(rootFolder);
|
|
148
148
|
return sendJson(req, res, cfg.importmap || {imports: {}}, method === 'HEAD');
|
|
149
149
|
}
|
|
150
|
+
if (url.pathname === '/favicon.ico') {
|
|
151
|
+
const faviconFile = path.join(rootFolder, webAppPath, 'favicon.ico');
|
|
152
|
+
const stat = await fsp.stat(faviconFile).catch(() => null);
|
|
153
|
+
if (stat && stat.isFile()) return sendFile(req, res, faviconFile, '.ico', method === 'HEAD');
|
|
154
|
+
return bailOut(req, res);
|
|
155
|
+
}
|
|
150
156
|
if (url.pathname === '/' || url.pathname === '/index' || url.pathname === '/index.html') {
|
|
151
157
|
// redirect to the web app
|
|
152
158
|
url.pathname = webAppPath;
|
package/index.js
CHANGED
|
@@ -38,7 +38,7 @@ const optionNames = {
|
|
|
38
38
|
n: 'showAssertNumber',
|
|
39
39
|
m: 'monochrome',
|
|
40
40
|
j: 'useJsonL',
|
|
41
|
-
c: '
|
|
41
|
+
c: 'noConsoleCapture',
|
|
42
42
|
h: 'hideStreams'
|
|
43
43
|
};
|
|
44
44
|
|
|
@@ -74,7 +74,7 @@ const init = async () => {
|
|
|
74
74
|
|
|
75
75
|
let originalConsole = null,
|
|
76
76
|
setCurrentReporter = null;
|
|
77
|
-
if (!options.
|
|
77
|
+
if (!options.noConsoleCapture && (isNode || isBun || isDeno)) {
|
|
78
78
|
const {captureConsole, setCurrentReporter: setReporter} = await import(
|
|
79
79
|
new URL('./src/utils/capture-console.js', import.meta.url)
|
|
80
80
|
);
|
package/llms-full.txt
CHANGED
|
@@ -286,11 +286,12 @@ Environment-specific subsections: `node`, `deno`, `bun`, `browser`.
|
|
|
286
286
|
Runs test files in parallel using worker threads.
|
|
287
287
|
|
|
288
288
|
```bash
|
|
289
|
-
tape6 [--flags FLAGS] [--par N] [tests...]
|
|
289
|
+
tape6 [--flags FLAGS] [--par N] [--info] [tests...]
|
|
290
290
|
```
|
|
291
291
|
|
|
292
292
|
- `--flags FLAGS` — output control flags (see below).
|
|
293
293
|
- `--par N` — number of parallel workers (default: all CPU cores).
|
|
294
|
+
- `--info` — print current configuration and exit without running tests.
|
|
294
295
|
- No arguments: runs tests from configuration.
|
|
295
296
|
|
|
296
297
|
### tape6-seq
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tape-six",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
4
4
|
"description": "TAP-based unit test library for Node, Deno, Bun, and browsers. ES modules, TypeScript, zero dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"@types/chai": "^5.2.3",
|
|
107
|
-
"@types/node": "^25.3.
|
|
107
|
+
"@types/node": "^25.3.3",
|
|
108
108
|
"chai": "^6.2.2",
|
|
109
109
|
"playwright": "^1.58.2",
|
|
110
110
|
"puppeteer": "^24.37.5",
|