tape-six-proc 0.12.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/.editorconfig +9 -0
- package/.gitmodules +3 -0
- package/.prettierrc +7 -0
- package/LICENSE +11 -0
- package/README.md +27 -0
- package/bin/tape6-proc-node.js +175 -0
- package/bin/tape6-proc.js +15 -0
- package/package.json +31 -0
- package/src/TestWorker.js +67 -0
- package/src/chain/jsonl-parse.js +17 -0
- package/src/chain/lines.js +21 -0
- package/wiki/Home.md +29 -0
- package/wiki/Release-notes.md +3 -0
- package/wiki/Utility-/342/200/220-tape6/342/200/220proc.md +65 -0
- package/wiki/Working-on-this-project.md +22 -0
package/.editorconfig
ADDED
package/.gitmodules
ADDED
package/.prettierrc
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Copyright 2005-2024 Eugene Lazutkin
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
+
|
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
+
|
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
|
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# tape-six-proc [![NPM version][npm-img]][npm-url]
|
|
2
|
+
|
|
3
|
+
[npm-img]: https://img.shields.io/npm/v/tape-six-proc.svg
|
|
4
|
+
[npm-url]: https://npmjs.org/package/tape-six-proc
|
|
5
|
+
|
|
6
|
+
`tape-six-proc` is a helper for [tape-six](https://www.npmjs.com/package/tape-six)
|
|
7
|
+
to run tests in separate processes.
|
|
8
|
+
|
|
9
|
+
## Docs
|
|
10
|
+
|
|
11
|
+
The documentation can be found in the [wiki](https://github.com/uhop/tape-six-proc/wiki).
|
|
12
|
+
`tape-six` has its own [wiki](https://github.com/uhop/tape-six/wiki).
|
|
13
|
+
|
|
14
|
+
`tape-six-proc` uses the same test configuration as `tape-six`. The utility `test6-proc`
|
|
15
|
+
has the same usage as `tape6`.
|
|
16
|
+
|
|
17
|
+
### Command-line utilities
|
|
18
|
+
|
|
19
|
+
* [tape6-proc](https://github.com/uhop/tape-six-proc/wiki/Utility-%E2%80%90-tape6-proc) — the main utility of this package to run tests in different environments.
|
|
20
|
+
|
|
21
|
+
## Release notes
|
|
22
|
+
|
|
23
|
+
The most recent releases:
|
|
24
|
+
|
|
25
|
+
* 0.12.0 *Initial release.*
|
|
26
|
+
|
|
27
|
+
For more info consult full [release notes](https://github.com/uhop/tape-six-proc/wiki/Release-notes).
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
import process from 'node:process';
|
|
6
|
+
import {fileURLToPath} from 'node:url';
|
|
7
|
+
|
|
8
|
+
import {resolveTests, resolvePatterns} from 'tape-six/utils/config.js';
|
|
9
|
+
|
|
10
|
+
import {getReporter, setReporter} from 'tape-six/test.js';
|
|
11
|
+
import State, {StopTest} from 'tape-six/State.js';
|
|
12
|
+
import TapReporter from 'tape-six/TapReporter.js';
|
|
13
|
+
import {selectTimer} from 'tape-six/utils/timer.js';
|
|
14
|
+
|
|
15
|
+
import TestWorker from '../src/TestWorker.js';
|
|
16
|
+
|
|
17
|
+
const options = {},
|
|
18
|
+
rootFolder = process.cwd();
|
|
19
|
+
|
|
20
|
+
let flags = '',
|
|
21
|
+
parallel = '',
|
|
22
|
+
runFileArgs = [],
|
|
23
|
+
files = [];
|
|
24
|
+
|
|
25
|
+
const showSelf = () => {
|
|
26
|
+
const self = new URL(import.meta.url);
|
|
27
|
+
if (self.protocol === 'file:') {
|
|
28
|
+
console.log(fileURLToPath(self));
|
|
29
|
+
} else {
|
|
30
|
+
console.log(self);
|
|
31
|
+
}
|
|
32
|
+
process.exit(0);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const config = () => {
|
|
36
|
+
if (process.argv.includes('--self')) showSelf();
|
|
37
|
+
|
|
38
|
+
const optionNames = {
|
|
39
|
+
f: 'failureOnly',
|
|
40
|
+
t: 'showTime',
|
|
41
|
+
b: 'showBanner',
|
|
42
|
+
d: 'showData',
|
|
43
|
+
o: 'failOnce',
|
|
44
|
+
n: 'showAssertNumber',
|
|
45
|
+
c: 'hasColors'
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
let flagIsSet = false,
|
|
49
|
+
parIsSet = false;
|
|
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
|
+
flagIsSet = true;
|
|
57
|
+
}
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (arg == '-p' || arg == '--par') {
|
|
61
|
+
if (++i < process.argv.length) {
|
|
62
|
+
parallel = process.argv[i];
|
|
63
|
+
parIsSet = true;
|
|
64
|
+
if (!parallel || isNaN(parallel)) {
|
|
65
|
+
parallel = '';
|
|
66
|
+
parIsSet = false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (arg == '-r' || arg == '--runFileArgs') {
|
|
72
|
+
if (++i < process.argv.length) {
|
|
73
|
+
runFileArgs.push(process.argv[i]);
|
|
74
|
+
}
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
files.push(arg);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!flagIsSet) {
|
|
81
|
+
flags = process.env.TAPE6_FLAGS || flags;
|
|
82
|
+
}
|
|
83
|
+
for (let i = 0; i < flags.length; ++i) {
|
|
84
|
+
const option = flags[i].toLowerCase(),
|
|
85
|
+
name = optionNames[option];
|
|
86
|
+
if (typeof name == 'string') options[name] = option !== flags[i];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!parIsSet) {
|
|
90
|
+
parallel = process.env.TAPE6_PAR || parallel;
|
|
91
|
+
}
|
|
92
|
+
if (parallel) {
|
|
93
|
+
parallel = Math.max(0, +parallel);
|
|
94
|
+
if (parallel === Infinity) parallel = 0;
|
|
95
|
+
} else {
|
|
96
|
+
parallel = 0;
|
|
97
|
+
}
|
|
98
|
+
if (!parallel) parallel = navigator.hardwareConcurrency;
|
|
99
|
+
|
|
100
|
+
options.runFileArgs = runFileArgs;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const init = async () => {
|
|
104
|
+
let reporter = getReporter();
|
|
105
|
+
if (!reporter) {
|
|
106
|
+
if (process.env.TAPE6_JSONL) {
|
|
107
|
+
const JSONLReporter = (await import('tape-six/JSONLReporter.js')).default,
|
|
108
|
+
jsonlReporter = new JSONLReporter(options);
|
|
109
|
+
reporter = jsonlReporter.report.bind(jsonlReporter);
|
|
110
|
+
} else if (!process.env.TAPE6_TAP) {
|
|
111
|
+
const TTYReporter = (await import('tape-six/TTYReporter.js')).default,
|
|
112
|
+
ttyReporter = new TTYReporter(options);
|
|
113
|
+
ttyReporter.testCounter = -2;
|
|
114
|
+
ttyReporter.technicalDepth = 1;
|
|
115
|
+
reporter = ttyReporter.report.bind(ttyReporter);
|
|
116
|
+
}
|
|
117
|
+
if (!reporter) {
|
|
118
|
+
const tapReporter = new TapReporter({useJson: true});
|
|
119
|
+
reporter = tapReporter.report.bind(tapReporter);
|
|
120
|
+
}
|
|
121
|
+
setReporter(reporter);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (files.length) {
|
|
125
|
+
files = await resolvePatterns(rootFolder, files);
|
|
126
|
+
} else {
|
|
127
|
+
let type = 'node';
|
|
128
|
+
if (typeof Deno == 'object') {
|
|
129
|
+
type = 'deno';
|
|
130
|
+
} else if (typeof Bun == 'object') {
|
|
131
|
+
type = 'bun';
|
|
132
|
+
}
|
|
133
|
+
files = await resolveTests(rootFolder, type);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const safeEmit = rootState => event => {
|
|
138
|
+
try {
|
|
139
|
+
rootState.emit(event);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
if (!(error instanceof StopTest)) throw error;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const main = async () => {
|
|
146
|
+
config();
|
|
147
|
+
await init();
|
|
148
|
+
await selectTimer();
|
|
149
|
+
|
|
150
|
+
process.on('uncaughtException', (error, origin) =>
|
|
151
|
+
console.error('UNHANDLED ERROR:', origin, error)
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
const rootState = new State(null, {callback: getReporter(), failOnce: options.failOnce}),
|
|
155
|
+
worker = new TestWorker(safeEmit(rootState), parallel, options);
|
|
156
|
+
|
|
157
|
+
rootState.emit({type: 'test', test: 0, time: rootState.timer.now()});
|
|
158
|
+
|
|
159
|
+
await new Promise(resolve => {
|
|
160
|
+
worker.done = () => resolve();
|
|
161
|
+
worker.execute(files);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
rootState.emit({
|
|
165
|
+
type: 'end',
|
|
166
|
+
test: 0,
|
|
167
|
+
time: rootState.timer.now(),
|
|
168
|
+
fail: rootState.failed > 0,
|
|
169
|
+
data: rootState
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
process.exit(rootState.failed > 0 ? 1 : 0);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
main().catch(error => console.error('ERROR:', error));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import process from 'node:process';
|
|
4
|
+
import {fileURLToPath} from 'node:url';
|
|
5
|
+
|
|
6
|
+
if (process.argv.includes('--self')) {
|
|
7
|
+
const self = new URL(import.meta.url);
|
|
8
|
+
if (self.protocol === 'file:') {
|
|
9
|
+
console.log(fileURLToPath(self));
|
|
10
|
+
} else {
|
|
11
|
+
console.log(self);
|
|
12
|
+
}
|
|
13
|
+
} else {
|
|
14
|
+
await import('./tape6-proc-node.js');
|
|
15
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tape-six-proc",
|
|
3
|
+
"version": "0.12.0",
|
|
4
|
+
"description": "Helper for TAP the test harness for the modern JavaScript (ES6) to run tests in separate processes.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"tape6-proc": "bin/tape6-proc.js"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"tap",
|
|
11
|
+
"test",
|
|
12
|
+
"harness",
|
|
13
|
+
"assert",
|
|
14
|
+
"process"
|
|
15
|
+
],
|
|
16
|
+
"author": "Eugene Lazutkin <eugene.lazutkin@gmail.com> (https://www.lazutkin.com)",
|
|
17
|
+
"funding": "https://github.com/sponsors/uhop",
|
|
18
|
+
"license": "BSD-3-Clause",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/uhop/tape-six-proc.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/uhop/tape-six-proc/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/uhop/tape-six-proc#readme",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"dollar-shell": "^1.1.0",
|
|
29
|
+
"tape-six": "^1.0.1"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import {sep} from 'node:path';
|
|
3
|
+
import {pathToFileURL, fileURLToPath} from 'node:url';
|
|
4
|
+
|
|
5
|
+
import {spawn, currentExecPath, runFileArgs} from 'dollar-shell';
|
|
6
|
+
|
|
7
|
+
import {StopTest} from 'tape-six/State.js';
|
|
8
|
+
import EventServer from 'tape-six/utils/EventServer.js';
|
|
9
|
+
|
|
10
|
+
import lines from './chain/lines.js';
|
|
11
|
+
import parse from './chain/jsonl-parse.js';
|
|
12
|
+
|
|
13
|
+
const baseName = pathToFileURL(process.cwd() + sep);
|
|
14
|
+
|
|
15
|
+
export default class TestWorker extends EventServer {
|
|
16
|
+
constructor(reporter, numberOfTasks = navigator.hardwareConcurrency, options) {
|
|
17
|
+
super(reporter, numberOfTasks, options);
|
|
18
|
+
this.counter = 0;
|
|
19
|
+
this.idToWorker = {};
|
|
20
|
+
}
|
|
21
|
+
makeTask(fileName) {
|
|
22
|
+
const testName = new URL(fileName, baseName),
|
|
23
|
+
id = String(++this.counter),
|
|
24
|
+
worker = spawn(
|
|
25
|
+
[
|
|
26
|
+
currentExecPath(),
|
|
27
|
+
...runFileArgs.concat((this.options.runFileArgs || []).filter(x => x)),
|
|
28
|
+
fileURLToPath(testName)
|
|
29
|
+
],
|
|
30
|
+
{
|
|
31
|
+
stdin: 'ignore',
|
|
32
|
+
stdout: 'pipe',
|
|
33
|
+
stderr: 'inherit',
|
|
34
|
+
env: {...process.env, TAPE6_TEST: id, TAPE6_JSONL: 'Y'}
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
this.idToWorker[id] = worker;
|
|
38
|
+
const self = this;
|
|
39
|
+
worker.stdout
|
|
40
|
+
.pipeThrough(new TextDecoderStream())
|
|
41
|
+
.pipeThrough(lines())
|
|
42
|
+
.pipeThrough(parse())
|
|
43
|
+
.pipeTo(
|
|
44
|
+
new WritableStream({
|
|
45
|
+
write(msg) {
|
|
46
|
+
try {
|
|
47
|
+
self.report(id, msg);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
if (!(error instanceof StopTest)) throw error;
|
|
50
|
+
}
|
|
51
|
+
if (msg.type === 'end' && msg.test === 0) {
|
|
52
|
+
self.close(id);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
return id;
|
|
59
|
+
}
|
|
60
|
+
destroyTask(id) {
|
|
61
|
+
const worker = this.idToWorker[id];
|
|
62
|
+
if (worker) {
|
|
63
|
+
// worker.kill();
|
|
64
|
+
delete this.idToWorker[id];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
export const parse = () =>
|
|
4
|
+
new TransformStream({
|
|
5
|
+
transform(line, controller) {
|
|
6
|
+
try {
|
|
7
|
+
const value = JSON.parse(line);
|
|
8
|
+
if (value && typeof value == 'object') {
|
|
9
|
+
controller.enqueue(value);
|
|
10
|
+
}
|
|
11
|
+
} catch (_) {
|
|
12
|
+
// squelch
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export default parse;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
export const lines = () => {
|
|
4
|
+
let rest = '';
|
|
5
|
+
return new TransformStream({
|
|
6
|
+
transform(chunk, controller) {
|
|
7
|
+
const lines = chunk.split(/\r?\n/g);
|
|
8
|
+
rest += lines[0];
|
|
9
|
+
if (lines.length < 2) return;
|
|
10
|
+
lines[0] = rest;
|
|
11
|
+
rest = lines.pop();
|
|
12
|
+
for (const line of lines) controller.enqueue(line);
|
|
13
|
+
},
|
|
14
|
+
flush(controller) {
|
|
15
|
+
controller.enqueue(rest);
|
|
16
|
+
rest = '';
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default lines;
|
package/wiki/Home.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!-- markdownlint-disable-next-line first-line-heading -->
|
|
2
|
+
`tape-six-proc` is a helper for [tape-six](https://www.npmjs.com/package/tape-six)
|
|
3
|
+
to run tests in separate processes.
|
|
4
|
+
|
|
5
|
+
Please consult the [tape-six wiki](https://github.com/uhop/tape-six/wiki) for more information.
|
|
6
|
+
|
|
7
|
+
# How to use
|
|
8
|
+
|
|
9
|
+
1. Install `tape-six-proc` in your project: `npm i -D tape-six-proc`.
|
|
10
|
+
2. Write tests.
|
|
11
|
+
3. Configure your tests: [set-up tests](https://github.com/uhop/tape-six/wiki/Set-up-tests).
|
|
12
|
+
4. Run tests: `npm test`.
|
|
13
|
+
|
|
14
|
+
# Available utilities
|
|
15
|
+
|
|
16
|
+
Test files are directly executable with `node` or `deno` or `bun` or in a browser.
|
|
17
|
+
[tape-six](https://www.npmjs.com/package/tape-six) helps to organize tests. This package
|
|
18
|
+
provides a utility to run tests in isolated processes:
|
|
19
|
+
|
|
20
|
+
* [tape6-proc](./Utility-‐-tape6‐proc) to run tests in separate processes.
|
|
21
|
+
|
|
22
|
+
# Formalities
|
|
23
|
+
|
|
24
|
+
The project is distributed under the 3-clause BSD license.
|
|
25
|
+
|
|
26
|
+
Other pertinent information:
|
|
27
|
+
|
|
28
|
+
* [Release notes](./Release-notes).
|
|
29
|
+
* [Working on this project](./Working-on-this-project).
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<!-- markdownlint-disable-next-line first-line-heading -->
|
|
2
|
+
The main utility of the package is `tape6-proc`.
|
|
3
|
+
|
|
4
|
+
# Usage
|
|
5
|
+
|
|
6
|
+
Assuming that the tests are properly configured
|
|
7
|
+
(see [Set-up tests](https://github.com/uhop/tape-six/wiki/Set-up-tests)),
|
|
8
|
+
it can be invoked without arguments:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npx tape6-proc
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`tape6-proc` is modelled after [tape6](https://github.com/uhop/tape-six/wiki/Utility-%E2%80%90-tape6)
|
|
15
|
+
and can be used the same way.
|
|
16
|
+
|
|
17
|
+
# Configuring `tape6-proc`
|
|
18
|
+
|
|
19
|
+
`tape6-proc` supports the same configuration as
|
|
20
|
+
[tape6](https://github.com/uhop/tape-six/wiki/Utility-%E2%80%90-tape6).
|
|
21
|
+
|
|
22
|
+
Additionally it supports the following flags:
|
|
23
|
+
|
|
24
|
+
* `--runFileArgs ARGS` — sets the arguments to pass to the test file.
|
|
25
|
+
* Shortcut: `-r ARGS`.
|
|
26
|
+
* This flag can be used multiple times.
|
|
27
|
+
|
|
28
|
+
This flag is used mostly with Deno to supply additional arguments to the test file.
|
|
29
|
+
|
|
30
|
+
For example, we want to add `-A` (`--allow-all` permissions) to run a test file:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
deno run -A `npx tape6-proc --self` --runFileArgs -A
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
# Implementation details
|
|
37
|
+
|
|
38
|
+
Technically, `tape6-proc` is an executable command-line utility, which is set to be executed with
|
|
39
|
+
the current Node. If you want to use it in different environments, you can use the `--self` flag:
|
|
40
|
+
|
|
41
|
+
Example of `package.json`:
|
|
42
|
+
|
|
43
|
+
```jsonc
|
|
44
|
+
{
|
|
45
|
+
"scripts": {
|
|
46
|
+
"test": "tape6-proc --flags FO",
|
|
47
|
+
"test:node": "tape6-proc --flags FO",
|
|
48
|
+
"test:bun": "bun run `npx tape6-proc --self` --flags FO",
|
|
49
|
+
"test:deno": "deno run -A `npx tape6-proc --self` --flags FO --runFileArgs -A"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
With scripts like above you can test your project in different environments:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm test
|
|
58
|
+
npm run test:bun
|
|
59
|
+
npm run test:deno
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Test environment
|
|
63
|
+
|
|
64
|
+
All environments spawn child processes to run tests using
|
|
65
|
+
[dollar-shell](https://www.npmjs.com/package/dollar-shell).
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!-- markdownlint-disable-next-line first-line-heading -->
|
|
2
|
+
This project uses git submodules, so the correct way to get it is:
|
|
3
|
+
|
|
4
|
+
```bash
|
|
5
|
+
git clone --recursive git@github.com:uhop/tape-six-proc.git
|
|
6
|
+
cd tape-six-proc
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
For older versions of `git`:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
git clone git@github.com:uhop/tape-six-proc.git
|
|
13
|
+
cd tape-six-proc
|
|
14
|
+
git submodule update --init --recursive
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Don't forget to install dependencies and run a build:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install
|
|
21
|
+
npm run build
|
|
22
|
+
```
|