tape-six-proc 1.1.6 → 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
CHANGED
|
@@ -22,6 +22,7 @@ has the same usage as `tape6`.
|
|
|
22
22
|
|
|
23
23
|
The most recent releases:
|
|
24
24
|
|
|
25
|
+
- 1.2.0 _Updated dependencies and synchronized the implementation with `tape-six` 1.5.0._
|
|
25
26
|
- 1.1.6 _Updated dependencies._
|
|
26
27
|
- 1.1.5 _Updated dependencies._
|
|
27
28
|
- 1.1.4 _Updated dependencies._
|
package/bin/tape6-proc-node.js
CHANGED
|
@@ -9,8 +9,7 @@ import {fileURLToPath} from 'node:url';
|
|
|
9
9
|
import {resolveTests, resolvePatterns} from 'tape-six/utils/config.js';
|
|
10
10
|
|
|
11
11
|
import {getReporter, setReporter} from 'tape-six/test.js';
|
|
12
|
-
import
|
|
13
|
-
import TapReporter from 'tape-six/TapReporter.js';
|
|
12
|
+
import TapReporter from 'tape-six/reporters/TapReporter.js';
|
|
14
13
|
import {selectTimer} from 'tape-six/utils/timer.js';
|
|
15
14
|
|
|
16
15
|
import TestWorker from '../src/TestWorker.js';
|
|
@@ -115,19 +114,14 @@ const init = async () => {
|
|
|
115
114
|
let reporter = getReporter();
|
|
116
115
|
if (!reporter) {
|
|
117
116
|
if (process.env.TAPE6_JSONL) {
|
|
118
|
-
const {JSONLReporter} = await import('tape-six/JSONLReporter.js')
|
|
119
|
-
|
|
120
|
-
reporter = jsonlReporter.report.bind(jsonlReporter);
|
|
117
|
+
const {JSONLReporter} = await import('tape-six/reporters/JSONLReporter.js');
|
|
118
|
+
reporter = new JSONLReporter(options);
|
|
121
119
|
} else if (!process.env.TAPE6_TAP) {
|
|
122
|
-
const {TTYReporter} = await import('tape-six/TTYReporter.js')
|
|
123
|
-
|
|
124
|
-
ttyReporter.testCounter = -2;
|
|
125
|
-
ttyReporter.technicalDepth = 1;
|
|
126
|
-
reporter = ttyReporter.report.bind(ttyReporter);
|
|
120
|
+
const {TTYReporter} = await import('tape-six/reporters/TTYReporter.js');
|
|
121
|
+
reporter = new TTYReporter(options);
|
|
127
122
|
}
|
|
128
123
|
if (!reporter) {
|
|
129
|
-
|
|
130
|
-
reporter = tapReporter.report.bind(tapReporter);
|
|
124
|
+
reporter = new TapReporter({useJson: true});
|
|
131
125
|
}
|
|
132
126
|
setReporter(reporter);
|
|
133
127
|
}
|
|
@@ -145,14 +139,6 @@ const init = async () => {
|
|
|
145
139
|
}
|
|
146
140
|
};
|
|
147
141
|
|
|
148
|
-
const safeEmit = rootState => event => {
|
|
149
|
-
try {
|
|
150
|
-
rootState.emit(event);
|
|
151
|
-
} catch (error) {
|
|
152
|
-
if (!(error instanceof StopTest)) throw error;
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
142
|
const main = async () => {
|
|
157
143
|
config();
|
|
158
144
|
await init();
|
|
@@ -162,25 +148,25 @@ const main = async () => {
|
|
|
162
148
|
console.error('UNHANDLED ERROR:', origin, error)
|
|
163
149
|
);
|
|
164
150
|
|
|
165
|
-
const
|
|
166
|
-
worker = new TestWorker(
|
|
151
|
+
const reporter = getReporter(),
|
|
152
|
+
worker = new TestWorker(reporter, parallel, options);
|
|
167
153
|
|
|
168
|
-
|
|
154
|
+
reporter.report({type: 'test', test: 0, name: ''});
|
|
169
155
|
|
|
170
156
|
await new Promise(resolve => {
|
|
171
157
|
worker.done = () => resolve();
|
|
172
158
|
worker.execute(files);
|
|
173
159
|
});
|
|
174
160
|
|
|
175
|
-
|
|
161
|
+
const hasFailed = reporter.state && reporter.state.failed > 0;
|
|
162
|
+
|
|
163
|
+
reporter.report({
|
|
176
164
|
type: 'end',
|
|
177
165
|
test: 0,
|
|
178
|
-
|
|
179
|
-
fail: rootState.failed > 0,
|
|
180
|
-
data: rootState
|
|
166
|
+
fail: hasFailed
|
|
181
167
|
});
|
|
182
168
|
|
|
183
|
-
process.exit(
|
|
169
|
+
process.exit(hasFailed ? 1 : 0);
|
|
184
170
|
};
|
|
185
171
|
|
|
186
172
|
main().catch(error => console.error('ERROR:', error));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tape-six-proc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Helper for TAP the test harness for the modern JavaScript (ES6) to run tests in separate processes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/uhop/tape-six-proc#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"dollar-shell": "^1.1.
|
|
36
|
-
"tape-six": "^1.
|
|
35
|
+
"dollar-shell": "^1.1.6",
|
|
36
|
+
"tape-six": "^1.5.0"
|
|
37
37
|
},
|
|
38
38
|
"tape6": {
|
|
39
39
|
"tests": [
|
package/src/TestWorker.js
CHANGED
|
@@ -6,7 +6,7 @@ import crypto from 'node:crypto';
|
|
|
6
6
|
|
|
7
7
|
import {spawn, currentExecPath, runFileArgs} from 'dollar-shell';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import {isStopTest} from 'tape-six/State.js';
|
|
10
10
|
import EventServer from 'tape-six/utils/EventServer.js';
|
|
11
11
|
import getDeferred from 'tape-six/utils/getDeferred.js';
|
|
12
12
|
|
|
@@ -55,7 +55,7 @@ export default class TestWorker extends EventServer {
|
|
|
55
55
|
try {
|
|
56
56
|
self.report(id, msg);
|
|
57
57
|
} catch (error) {
|
|
58
|
-
if (!(error
|
|
58
|
+
if (!isStopTest(error)) {
|
|
59
59
|
stdoutDeferred.reject(error);
|
|
60
60
|
throw error;
|
|
61
61
|
}
|
|
@@ -81,9 +81,28 @@ export default class TestWorker extends EventServer {
|
|
|
81
81
|
}
|
|
82
82
|
})
|
|
83
83
|
);
|
|
84
|
-
Promise.allSettled([worker.exited, stdoutDeferred.promise, stderrDeferred.promise]).then(() =>
|
|
85
|
-
self.
|
|
86
|
-
|
|
84
|
+
Promise.allSettled([worker.exited, stdoutDeferred.promise, stderrDeferred.promise]).then(() => {
|
|
85
|
+
if (!self.reporter.state || !self.reporter.state.failed) {
|
|
86
|
+
const reason = [];
|
|
87
|
+
if (worker.exitCode) {
|
|
88
|
+
reason.push(`exit code: ${worker.exitCode}`);
|
|
89
|
+
}
|
|
90
|
+
if (worker.signalCode) {
|
|
91
|
+
reason.push(`signal: ${worker.signalCode}`);
|
|
92
|
+
}
|
|
93
|
+
if (reason.length) {
|
|
94
|
+
self.report(id, {
|
|
95
|
+
name: 'process has failed, ' + reason.join(', '),
|
|
96
|
+
test: 0,
|
|
97
|
+
marker: new Error(),
|
|
98
|
+
operator: 'error',
|
|
99
|
+
fail: true
|
|
100
|
+
});
|
|
101
|
+
self.report(id, {type: 'terminated', test: 0, name: 'FILE: /' + fileName});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
self.close(id);
|
|
105
|
+
});
|
|
87
106
|
return id;
|
|
88
107
|
}
|
|
89
108
|
destroyTask(id) {
|