tape-six-proc 1.2.2 → 1.2.4

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
@@ -4,24 +4,92 @@
4
4
  [npm-url]: https://npmjs.org/package/tape-six-proc
5
5
 
6
6
  `tape-six-proc` is a helper for [tape-six](https://www.npmjs.com/package/tape-six)
7
- to run tests in separate processes.
7
+ to run tests in separate processes. It works with Node, Deno, and Bun,
8
+ and supports TypeScript natively without transpilation.
9
+
10
+ ## Why?
11
+
12
+ The standard `tape6` runner uses worker threads. `tape6-proc` spawns each test file
13
+ in its own subprocess instead, providing full process isolation. This prevents shared-state
14
+ leaks and is useful when tests need a clean environment. TypeScript test files (`.ts`)
15
+ run natively on modern Node, Deno, and Bun — no transpilation needed.
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ npm i -D tape-six-proc
21
+ ```
22
+
23
+ ## Quick start
24
+
25
+ 1. Write tests using [tape-six](https://www.npmjs.com/package/tape-six):
26
+
27
+ ```js
28
+ import test from 'tape-six';
29
+
30
+ test('example', t => {
31
+ t.ok(true, 'truthy');
32
+ t.equal(1 + 1, 2, 'math works');
33
+ });
34
+ ```
35
+
36
+ 2. Configure tests in `package.json`:
37
+
38
+ ```json
39
+ {
40
+ "scripts": {
41
+ "test": "tape6-proc --flags FO"
42
+ },
43
+ "tape6": {
44
+ "tests": ["/tests/test-*.*js"]
45
+ }
46
+ }
47
+ ```
48
+
49
+ 3. Run:
50
+
51
+ ```bash
52
+ npm test
53
+ ```
54
+
55
+ ## Cross-runtime usage
56
+
57
+ ```json
58
+ {
59
+ "scripts": {
60
+ "test": "tape6-proc --flags FO",
61
+ "test:bun": "bun run `tape6-proc --self` --flags FO",
62
+ "test:deno": "deno run -A `tape6-proc --self` --flags FO -r -A"
63
+ }
64
+ }
65
+ ```
8
66
 
9
67
  ## Docs
10
68
 
11
- The documentation can be found in the [wiki](https://github.com/uhop/tape-six-proc/wiki).
69
+ See the [wiki](https://github.com/uhop/tape-six-proc/wiki) for full documentation.
12
70
  `tape-six` has its own [wiki](https://github.com/uhop/tape-six/wiki).
13
71
 
14
- `tape-six-proc` uses the same test configuration as `tape-six`. The utility `test6-proc`
15
- has the same usage as `tape6`.
72
+ `tape-six-proc` uses the same test configuration and CLI conventions as `tape-six`.
16
73
 
17
74
  ### Command-line utilities
18
75
 
19
76
  - [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
77
 
78
+ ## AI agents
79
+
80
+ If you are an AI coding agent, see [AGENTS.md](./AGENTS.md) for project conventions, commands, and architecture.
81
+
82
+ LLM-friendly documentation is available:
83
+
84
+ - [llms.txt](./llms.txt) — concise reference.
85
+ - [llms-full.txt](./llms-full.txt) — full reference with architecture details.
86
+
21
87
  ## Release notes
22
88
 
23
89
  The most recent releases:
24
90
 
91
+ - 1.2.4 _Synchronized with `tape-six` 1.7.4. Added Min reporter support. Improved docs and npm keywords._
92
+ - 1.2.3 _Updated dependencies, cleaned up docs, added AI-friendly links and TS info._
25
93
  - 1.2.2 _Synchronized the implementation with `tape-six` 1.7.0._
26
94
  - 1.2.1 _Synchronized the implementation with `tape-six` 1.5.1._
27
95
  - 1.2.0 _Updated dependencies and synchronized the implementation with `tape-six` 1.5.0._
@@ -36,4 +104,4 @@ The most recent releases:
36
104
  - 1.0.1 _Updated dependencies._
37
105
  - 1.0.0 _The first official release._
38
106
 
39
- For more info consult full [release notes](https://github.com/uhop/tape-six-proc/wiki/Release-notes).
107
+ See the full [release notes](https://github.com/uhop/tape-six-proc/wiki/Release-notes) for details.
@@ -1,15 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- 'use strict';
4
-
5
3
  import process from 'node:process';
6
4
  import os from 'node:os';
7
5
  import {fileURLToPath} from 'node:url';
8
6
 
9
- import {resolveTests, resolvePatterns} from 'tape-six/utils/config.js';
7
+ import {
8
+ getReporterFileName,
9
+ getReporterType,
10
+ resolveTests,
11
+ resolvePatterns,
12
+ runtime
13
+ } from 'tape-six/utils/config.js';
10
14
 
11
15
  import {getReporter, setReporter} from 'tape-six/test.js';
12
- import TapReporter from 'tape-six/reporters/TapReporter.js';
13
16
  import {selectTimer} from 'tape-six/utils/timer.js';
14
17
 
15
18
  import TestWorker from '../src/TestWorker.js';
@@ -53,7 +56,7 @@ const config = () => {
53
56
  const arg = process.argv[i];
54
57
  if (arg == '-f' || arg == '--flags') {
55
58
  if (++i < process.argv.length) {
56
- flags = process.argv[i];
59
+ flags += process.argv[i];
57
60
  }
58
61
  continue;
59
62
  }
@@ -111,31 +114,26 @@ const config = () => {
111
114
  };
112
115
 
113
116
  const init = async () => {
114
- let reporter = getReporter();
115
- if (!reporter) {
116
- if (process.env.TAPE6_JSONL) {
117
- const {JSONLReporter} = await import('tape-six/reporters/JSONLReporter.js');
118
- reporter = new JSONLReporter(options);
119
- } else if (!process.env.TAPE6_TAP) {
120
- const {TTYReporter} = await import('tape-six/reporters/TTYReporter.js');
121
- reporter = new TTYReporter(options);
122
- }
123
- if (!reporter) {
124
- reporter = new TapReporter({useJson: true});
125
- }
126
- setReporter(reporter);
117
+ const currentReporter = getReporter();
118
+ if (!currentReporter) {
119
+ const reporterType = getReporterType(),
120
+ reporterFile = getReporterFileName(reporterType),
121
+ CustomReporter = (await import('tape-six/reporters/' + reporterFile)).default,
122
+ hasColors = !(
123
+ options.monochrome ||
124
+ process.env.NO_COLOR ||
125
+ process.env.NODE_DISABLE_COLORS ||
126
+ process.env.FORCE_COLOR === '0'
127
+ ),
128
+ customOptions = reporterType === 'tap' ? {useJson: true, hasColors} : {...options, hasColors},
129
+ customReporter = new CustomReporter(customOptions);
130
+ setReporter(customReporter);
127
131
  }
128
132
 
129
133
  if (files.length) {
130
134
  files = await resolvePatterns(rootFolder, files);
131
135
  } else {
132
- let type = 'node';
133
- if (typeof Deno == 'object') {
134
- type = 'deno';
135
- } else if (typeof Bun == 'object') {
136
- type = 'bun';
137
- }
138
- files = await resolveTests(rootFolder, type);
136
+ files = await resolveTests(rootFolder, runtime.name);
139
137
  }
140
138
  };
141
139
 
@@ -144,14 +142,20 @@ const main = async () => {
144
142
  await init();
145
143
  await selectTimer();
146
144
 
147
- process.on('uncaughtException', (error, origin) =>
148
- console.error('UNHANDLED ERROR:', origin, error)
149
- );
145
+ process.on('uncaughtException', (error, origin) => {
146
+ console.error('UNHANDLED ERROR:', origin, error);
147
+ process.exit(1);
148
+ });
149
+
150
+ if (!files.length) {
151
+ console.log('No files found.');
152
+ process.exit(1);
153
+ }
150
154
 
151
155
  const reporter = getReporter(),
152
156
  worker = new TestWorker(reporter, parallel, options);
153
157
 
154
- reporter.report({type: 'test', test: 0, name: ''});
158
+ reporter.report({type: 'test', test: 0});
155
159
 
156
160
  await new Promise(resolve => {
157
161
  worker.done = () => resolve();
package/llms-full.txt ADDED
@@ -0,0 +1,237 @@
1
+ # tape-six-proc
2
+
3
+ > A helper for [tape-six](https://github.com/uhop/tape-six) that runs test files in separate processes (subprocesses) instead of worker threads. Works with Node, Deno, and Bun. Supports TypeScript natively without transpilation. The npm package name is `tape-six-proc` and the CLI command is `tape6-proc`.
4
+
5
+ - Process isolation: each test file runs in its own subprocess
6
+ - Cross-runtime: Node, Deno, and Bun with the same test files
7
+ - TypeScript without transpilation: runs `.ts` test files natively on modern Node, Deno, and Bun
8
+ - Drop-in replacement for `tape6` (worker-thread runner)
9
+ - Same configuration format as `tape-six`
10
+ - Parallel execution with configurable concurrency
11
+ - TAP, TTY (colored), JSONL, and minimal output formats
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm i -D tape-six-proc
17
+ ```
18
+
19
+ ## Quick start
20
+
21
+ Write a test (`tests/test-example.js`):
22
+
23
+ ```js
24
+ import test from 'tape-six';
25
+
26
+ test('example', t => {
27
+ t.ok(true, 'truthy');
28
+ t.equal(1 + 1, 2, 'math works');
29
+ t.deepEqual([1, 2], [1, 2], 'arrays match');
30
+ });
31
+ ```
32
+
33
+ Run it directly:
34
+
35
+ ```bash
36
+ node tests/test-example.js
37
+ ```
38
+
39
+ Or run all configured tests via processes:
40
+
41
+ ```bash
42
+ tape6-proc --flags FO
43
+ ```
44
+
45
+ ## CLI: tape6-proc
46
+
47
+ Runs test files in parallel, each in its own subprocess.
48
+
49
+ ```bash
50
+ tape6-proc [--flags FLAGS] [--par N] [--runFileArgs ARGS] [tests...]
51
+ ```
52
+
53
+ ### Options
54
+
55
+ - `--flags FLAGS` (`-f`) — output control flags (see Supported flags below).
56
+ - `--par N` (`-p`) — number of parallel processes. Default: all CPU cores (via `os.availableParallelism()` or `navigator.hardwareConcurrency`).
57
+ - `--runFileArgs ARGS` (`-r`) — extra arguments passed to the spawned interpreter. Can be specified multiple times. Mainly used for Deno permissions.
58
+ - `--self` — prints the absolute path to `tape6-proc.js` and exits. Used in cross-runtime scripts.
59
+ - Positional arguments: test file glob patterns. If none given, reads from configuration.
60
+
61
+ ### Examples
62
+
63
+ ```bash
64
+ # Run all configured tests
65
+ tape6-proc --flags FO
66
+
67
+ # Run specific test files
68
+ tape6-proc tests/test-foo.js tests/test-bar.js
69
+
70
+ # Limit parallelism
71
+ tape6-proc --par 4 --flags FO
72
+
73
+ # Pass Deno permissions to spawned processes
74
+ tape6-proc -r --allow-read -r --allow-env --flags FO
75
+ ```
76
+
77
+ ## Cross-runtime usage
78
+
79
+ `tape6-proc` is a Node CLI by default. For Bun and Deno, use the `--self` flag to get the script path:
80
+
81
+ ```json
82
+ {
83
+ "scripts": {
84
+ "test": "tape6-proc --flags FO",
85
+ "test:node": "tape6-proc --flags FO",
86
+ "test:bun": "bun run `tape6-proc --self` --flags FO",
87
+ "test:deno": "deno run -A `tape6-proc --self` --flags FO -r -A"
88
+ }
89
+ }
90
+ ```
91
+
92
+ ### Deno permissions
93
+
94
+ Deno requires explicit permissions. Use `-r` (alias for `--runFileArgs`) to pass them to each spawned test process:
95
+
96
+ ```bash
97
+ # All permissions
98
+ deno run -A `tape6-proc --self` -r -A
99
+
100
+ # Fine-grained permissions
101
+ deno run -A `tape6-proc --self` -r --allow-read -r --allow-env
102
+ ```
103
+
104
+ Note: the first `-A` is for the `tape6-proc` process itself; the `-r` flags are forwarded to spawned test processes.
105
+
106
+ ## Supported flags
107
+
108
+ Flags are a string of characters. Uppercase = enabled, lowercase = disabled.
109
+
110
+ - `F` — Failures only: show only failed tests.
111
+ - `T` — show Time for each test.
112
+ - `B` — show Banner with summary.
113
+ - `D` — show Data of failed tests.
114
+ - `O` — fail Once: stop at first failure.
115
+ - `N` — show assert Number.
116
+ - `M` — Monochrome: no colors.
117
+ - `C` — don't Capture console output.
118
+ - `H` — Hide streams and console output.
119
+
120
+ Usage:
121
+
122
+ ```bash
123
+ tape6-proc --flags FO
124
+ TAPE6_FLAGS=FO node tests/test-example.js
125
+ ```
126
+
127
+ ## Configuration
128
+
129
+ Configuration is read from `tape6.json` or the `"tape6"` section of `package.json` (same format as `tape-six`):
130
+
131
+ ```json
132
+ {
133
+ "tape6": {
134
+ "tests": ["/tests/test-*.*js"],
135
+ "cli": ["/tests/test-*.cjs"]
136
+ }
137
+ }
138
+ ```
139
+
140
+ Environment-specific subsections (`node`, `deno`, `bun`) are supported. The runner auto-detects the current runtime and uses the appropriate subsection.
141
+
142
+ ## Environment variables
143
+
144
+ - `TAPE6_FLAGS` — flags string (combined with `--flags` CLI argument).
145
+ - `TAPE6_PAR` — number of parallel processes (overridden by `--par`).
146
+ - `TAPE6_TAP` — force TAP reporter (any non-empty value).
147
+ - `TAPE6_JSONL` — force JSONL reporter (any non-empty value).
148
+ - `TAPE6_MIN` — force minimal reporter (any non-empty value).
149
+ - `TAPE6_TEST` — set by the runner: unique ID for each spawned test process.
150
+ - `TAPE6_TEST_FILE_NAME` — set by the runner: file name of the current test.
151
+ - `TAPE6_JSONL_PREFIX` — set by the runner: UUID prefix for JSONL lines in stdout.
152
+
153
+ ## Architecture
154
+
155
+ ### Entry point
156
+
157
+ `bin/tape6-proc.js` is the CLI entry point:
158
+
159
+ - With `--self`: prints its own absolute path and exits.
160
+ - Otherwise: delegates to `bin/tape6-proc-node.js`.
161
+
162
+ ### Main CLI (`bin/tape6-proc-node.js`)
163
+
164
+ 1. Parses CLI arguments (`--flags`, `--par`, `--runFileArgs`, positional test patterns).
165
+ 2. Selects reporter: TTY (default for terminals), TAP, JSONL, or Min (based on environment variables).
166
+ 3. Resolves test files from configuration or CLI patterns using `tape-six/utils/config.js`.
167
+ 4. Creates a `TestWorker` instance and executes all test files.
168
+ 5. Reports final results and exits with code 0 (success) or 1 (failures).
169
+
170
+ ### TestWorker (`src/TestWorker.js`)
171
+
172
+ Extends `EventServer` from `tape-six`. Manages parallel subprocess execution:
173
+
174
+ - **`constructor(reporter, numberOfTasks, options)`** — initializes with a reporter, concurrency limit, and options. Generates a UUID prefix for JSONL parsing.
175
+ - **`makeTask(fileName)`** — spawns a child process for a test file using `dollar-shell`. Sets up stream pipelines for stdout and stderr. Returns a task ID.
176
+ - **`destroyTask(id)`** — cleans up a completed task.
177
+ - **`getConcurrency()`** — static method, returns available CPU cores.
178
+
179
+ ### Stream pipeline
180
+
181
+ Each spawned process has two stream pipelines:
182
+
183
+ **stdout pipeline:**
184
+ ```
185
+ process.stdout → TextDecoderStream → lines → parse-prefixed-jsonl → report
186
+ ```
187
+
188
+ - `lines` (`src/streams/lines.js`): TransformStream that splits text into individual lines.
189
+ - `parse-prefixed-jsonl` (`src/streams/parse-prefixed-jsonl.js`): TransformStream that recognizes lines starting with the UUID prefix, parses them as JSON, and passes through non-prefixed lines as `{type: 'stdout', name: line}` objects.
190
+
191
+ **stderr pipeline:**
192
+ ```
193
+ process.stderr → TextDecoderStream → lines → wrap-lines → report
194
+ ```
195
+
196
+ - `wrap-lines` (`src/streams/wrap-lines.js`): TransformStream that wraps each line as `{type: 'stderr', name: line}`.
197
+
198
+ ### Process lifecycle
199
+
200
+ 1. Process is spawned with environment variables: `TAPE6_FLAGS`, `TAPE6_TEST`, `TAPE6_TEST_FILE_NAME`, `TAPE6_JSONL=Y`, `TAPE6_JSONL_PREFIX`.
201
+ 2. The test file runs and outputs JSONL-prefixed lines to stdout.
202
+ 3. After the process exits, `TestWorker` checks exit code and signal.
203
+ 4. Non-zero exit codes are reported as errors with a `{type: 'terminated'}` event.
204
+ 5. The task is closed and the next queued test file starts.
205
+
206
+ ## Dependencies
207
+
208
+ - **`tape-six`** — the core test library. Imports: `State.js`, `utils/EventServer.js`, `utils/makeDeferred.js`, `utils/config.js`, `test.js`, reporters (`TTYReporter`, `TapReporter`, `JSONLReporter`, `MinReporter`), `utils/timer.js`.
209
+ - **`dollar-shell`** — cross-runtime process spawning. Imports: `spawn`, `currentExecPath`, `runFileArgs`.
210
+
211
+ ## Writing tests
212
+
213
+ Tests are standard `tape-six` tests. See the [tape-six documentation](https://github.com/uhop/tape-six/wiki) for the full API.
214
+
215
+ ```js
216
+ import test from 'tape-six';
217
+
218
+ test('arithmetic', t => {
219
+ t.equal(2 + 2, 4, 'addition');
220
+ t.ok(10 > 5, 'comparison');
221
+ });
222
+
223
+ test('async operation', async t => {
224
+ const result = await fetchData();
225
+ t.ok(result, 'got result');
226
+ t.equal(result.status, 200, 'status is 200');
227
+ });
228
+ ```
229
+
230
+ Test files should be directly executable: `node tests/test-foo.js` or `node tests/test-foo.ts`
231
+
232
+ ## Links
233
+
234
+ - Docs: https://github.com/uhop/tape-six-proc/wiki
235
+ - npm: https://www.npmjs.com/package/tape-six-proc
236
+ - tape-six: https://github.com/uhop/tape-six
237
+ - tape-six LLM reference: https://github.com/uhop/tape-six/blob/master/llms.txt
package/llms.txt ADDED
@@ -0,0 +1,108 @@
1
+ # tape-six-proc
2
+
3
+ > Helper for [tape-six](https://github.com/uhop/tape-six) that runs test files in separate processes instead of worker threads. Works with Node, Deno, and Bun. Supports TypeScript natively without transpilation.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm i -D tape-six-proc
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ 1. Write tests using `tape-six`:
14
+
15
+ ```js
16
+ import test from 'tape-six';
17
+
18
+ test('my test', async t => {
19
+ t.ok(true, 'truthy value');
20
+ t.equal(1 + 1, 2, 'addition works');
21
+ });
22
+ ```
23
+
24
+ 2. Configure tests in `package.json`:
25
+
26
+ ```json
27
+ {
28
+ "scripts": {
29
+ "test": "tape6-proc --flags FO"
30
+ },
31
+ "tape6": {
32
+ "tests": ["/tests/test-*.*js"]
33
+ }
34
+ }
35
+ ```
36
+
37
+ 3. Run: `npm test`
38
+
39
+ ## Why use tape-six-proc?
40
+
41
+ - **Process isolation** — each test file runs in its own subprocess, preventing shared state leaks.
42
+ - **Cross-runtime** — works with Node, Deno, and Bun using the same test files.
43
+ - **TypeScript without transpilation** — runs `.ts` test files natively on modern Node, Deno, and Bun.
44
+ - **Drop-in replacement** — uses the same configuration and test format as `tape6` (worker-thread runner).
45
+
46
+ ## CLI: tape6-proc
47
+
48
+ ```bash
49
+ tape6-proc [--flags FLAGS] [--par N] [--runFileArgs ARGS] [tests...]
50
+ ```
51
+
52
+ ### Options
53
+
54
+ - `--flags FLAGS` (`-f`) — output control flags (same as tape6: F=failures only, T=time, B=banner, D=data, O=fail once, N=assert number, M=monochrome, C=don't capture console, H=hide streams). Can be specified multiple times.
55
+ - `--par N` (`-p`) — number of parallel processes (default: all CPU cores).
56
+ - `--runFileArgs ARGS` (`-r`) — extra arguments for the spawned interpreter. Can be specified multiple times. Mainly for Deno permissions.
57
+ - `--self` — prints the path to `tape6-proc.js` (for cross-runtime scripts).
58
+ - No arguments: runs tests from configuration.
59
+
60
+ ### Cross-runtime usage
61
+
62
+ ```json
63
+ {
64
+ "scripts": {
65
+ "test": "tape6-proc --flags FO",
66
+ "test:bun": "bun run `tape6-proc --self` --flags FO",
67
+ "test:deno": "deno run -A `tape6-proc --self` --flags FO -r -A"
68
+ }
69
+ }
70
+ ```
71
+
72
+ ### Deno permissions
73
+
74
+ Use `--runFileArgs` (`-r`) to pass permissions to spawned test processes:
75
+
76
+ ```bash
77
+ deno run -A `tape6-proc --self` -r --allow-read -r --allow-env
78
+ ```
79
+
80
+ ## Configuration
81
+
82
+ Same as `tape-six`. Reads from `tape6.json` or the `"tape6"` section of `package.json`:
83
+
84
+ ```json
85
+ {
86
+ "tape6": {
87
+ "tests": ["/tests/test-*.*js"]
88
+ }
89
+ }
90
+ ```
91
+
92
+ Environment-specific subsections: `node`, `deno`, `bun`.
93
+
94
+ ## Environment variables
95
+
96
+ - `TAPE6_FLAGS` — flags string.
97
+ - `TAPE6_PAR` — number of parallel processes.
98
+ - `TAPE6_TAP` — force TAP reporter.
99
+ - `TAPE6_JSONL` — force JSONL reporter.
100
+ - `TAPE6_MIN` — force minimal reporter.
101
+ - `TAPE6_TEST_FILE_NAME` — set by the runner: file name of the current test.
102
+
103
+ ## Links
104
+
105
+ - Docs: https://github.com/uhop/tape-six-proc/wiki
106
+ - npm: https://www.npmjs.com/package/tape-six-proc
107
+ - tape-six: https://github.com/uhop/tape-six
108
+ - Full LLM reference: https://github.com/uhop/tape-six-proc/blob/master/llms-full.txt
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tape-six-proc",
3
- "version": "1.2.2",
4
- "description": "Helper for TAP the test harness for the modern JavaScript (ES6) to run tests in separate processes.",
3
+ "version": "1.2.4",
4
+ "description": "Process-isolated test runner for tape-six. Runs each test file in its own subprocess. Works with Node, Deno, and Bun. Supports TypeScript without transpilation.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "tape6-proc": "bin/tape6-proc.js"
@@ -15,10 +15,25 @@
15
15
  },
16
16
  "keywords": [
17
17
  "tap",
18
+ "tape6",
19
+ "tape-six",
18
20
  "test",
21
+ "test-runner",
22
+ "unit-test",
23
+ "testing",
19
24
  "harness",
20
- "assert",
21
- "process"
25
+ "process",
26
+ "subprocess",
27
+ "isolation",
28
+ "parallel",
29
+ "cross-runtime",
30
+ "nodejs",
31
+ "deno",
32
+ "bun",
33
+ "esm",
34
+ "es-modules",
35
+ "typescript",
36
+ "no-transpile"
22
37
  ],
23
38
  "author": "Eugene Lazutkin <eugene.lazutkin@gmail.com> (https://www.lazutkin.com)",
24
39
  "funding": "https://github.com/sponsors/uhop",
@@ -31,9 +46,18 @@
31
46
  "url": "https://github.com/uhop/tape-six-proc/issues"
32
47
  },
33
48
  "homepage": "https://github.com/uhop/tape-six-proc#readme",
49
+ "github": "http://github.com/uhop/tape-six-proc",
50
+ "llms": "https://raw.githubusercontent.com/uhop/tape-six-proc/master/llms.txt",
51
+ "llmsFull": "https://raw.githubusercontent.com/uhop/tape-six-proc/master/llms-full.txt",
52
+ "files": [
53
+ "bin",
54
+ "src",
55
+ "llms.txt",
56
+ "llms-full.txt"
57
+ ],
34
58
  "dependencies": {
35
- "dollar-shell": "^1.1.8",
36
- "tape-six": "^1.7.0"
59
+ "dollar-shell": "^1.1.10",
60
+ "tape-six": "^1.7.4"
37
61
  },
38
62
  "tape6": {
39
63
  "tests": [
package/src/TestWorker.js CHANGED
@@ -91,17 +91,13 @@ export default class TestWorker extends EventServer {
91
91
  reason.push(`signal: ${worker.signalCode}`);
92
92
  }
93
93
  if (reason.length) {
94
- try {
95
- self.report(id, {
96
- name: 'process has failed, ' + reason.join(', '),
97
- test: 0,
98
- marker: new Error(),
99
- operator: 'error',
100
- fail: true
101
- });
102
- } catch (error) {
103
- if (!isStopTest(error)) throw error;
104
- }
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
+ });
105
101
  self.report(id, {type: 'terminated', test: 0, name: 'FILE: /' + fileName});
106
102
  }
107
103
  }
package/.editorconfig DELETED
@@ -1,9 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- charset = utf-8
5
- end_of_line = lf
6
- insert_final_newline = true
7
- trim_trailing_whitespace = true
8
- indent_style = space
9
- indent_size = 2
@@ -1,2 +0,0 @@
1
- github: uhop
2
- buy_me_a_coffee: uhop
@@ -1,76 +0,0 @@
1
- # For most projects, this workflow file will not need changing; you simply need
2
- # to commit it to your repository.
3
- #
4
- # You may wish to alter this file to override the set of languages analyzed,
5
- # or to provide custom queries or build logic.
6
- #
7
- # ******** NOTE ********
8
- # We have attempted to detect the languages in your repository. Please check
9
- # the `language` matrix defined below to confirm you have the correct set of
10
- # supported CodeQL languages.
11
- #
12
- name: 'CodeQL'
13
-
14
- on:
15
- push:
16
- branches: ['master']
17
- pull_request:
18
- # The branches below must be a subset of the branches above
19
- branches: ['master']
20
- schedule:
21
- - cron: '29 23 * * 0'
22
-
23
- jobs:
24
- analyze:
25
- name: Analyze
26
- runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
27
- timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
28
- permissions:
29
- actions: read
30
- contents: read
31
- security-events: write
32
-
33
- strategy:
34
- fail-fast: false
35
- matrix:
36
- language: ['javascript']
37
- # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
38
- # Use only 'java' to analyze code written in Java, Kotlin or both
39
- # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
40
- # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
41
-
42
- steps:
43
- - name: Checkout repository
44
- uses: actions/checkout@v4
45
-
46
- # Initializes the CodeQL tools for scanning.
47
- - name: Initialize CodeQL
48
- uses: github/codeql-action/init@v3
49
- with:
50
- languages: ${{ matrix.language }}
51
- # If you wish to specify custom queries, you can do so here or in a config file.
52
- # By default, queries listed here will override any specified in a config file.
53
- # Prefix the list here with "+" to use these queries and those in the config file.
54
-
55
- # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
56
- # queries: security-extended,security-and-quality
57
-
58
- # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
59
- # If this step fails, then you should remove it and run the build manually (see below)
60
- - name: Autobuild
61
- uses: github/codeql-action/autobuild@v3
62
-
63
- # ℹ️ Command-line programs to run using the OS shell.
64
- # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
65
-
66
- # If the Autobuild fails above, remove it and uncomment the following three lines.
67
- # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
68
-
69
- # - run: |
70
- # echo "Run, Build Application using script"
71
- # ./location_of_script_within_repo/buildscript.sh
72
-
73
- - name: Perform CodeQL Analysis
74
- uses: github/codeql-action/analyze@v3
75
- with:
76
- category: '/language:${{matrix.language}}'
@@ -1,32 +0,0 @@
1
- # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2
- # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
-
4
- name: Node.js CI
5
-
6
- on:
7
- push:
8
- branches: ['*']
9
- pull_request:
10
- branches: [master]
11
-
12
- jobs:
13
- tests:
14
- name: Node.js ${{matrix.node-version}} on ${{matrix.os}}
15
- runs-on: ${{matrix.os}}
16
-
17
- strategy:
18
- matrix:
19
- os: [ubuntu-latest, windows-latest, macOS-latest]
20
- node-version: [20, 22, 24, 25]
21
-
22
- steps:
23
- - uses: actions/checkout@v4
24
- with:
25
- submodules: true
26
- - uses: actions/setup-node@v4
27
- with:
28
- node-version: ${{matrix.node-version}}
29
- - run: |
30
- npm ci
31
- npm run build --if-present
32
- npm test
@@ -1,28 +0,0 @@
1
- name: Windows
2
-
3
- on:
4
- workflow_dispatch:
5
- inputs:
6
- node-version:
7
- description: 'Node.js version to run tests'
8
- required: true
9
- default: 25
10
- type: number
11
-
12
- jobs:
13
- tests:
14
- name: Node.js ${{inputs.node-version}} (special test)
15
- runs-on: windows-latest
16
-
17
- steps:
18
- - uses: actions/checkout@v4
19
- with:
20
- submodules: true
21
- - uses: actions/setup-node@v4
22
- with:
23
- node-version: ${{inputs.node-version}}
24
- - run: |
25
- npm ci
26
- npm run build --if-present
27
- npm test
28
- node tests/test-sample.js
package/.gitmodules DELETED
@@ -1,3 +0,0 @@
1
- [submodule "wiki"]
2
- path = wiki
3
- url = git@github.com:uhop/tape-six-proc.wiki
package/.prettierrc DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "printWidth": 100,
3
- "singleQuote": true,
4
- "bracketSpacing": false,
5
- "arrowParens": "avoid",
6
- "trailingComma": "none"
7
- }
@@ -1,10 +0,0 @@
1
- import assert from 'node:assert';
2
- import test from 'tape-six';
3
-
4
- test('Using standard assert', t => {
5
- t.pass('Pass #1');
6
- // assert.strict.deepEqual([1], [2], '1 should be equal to 2!');
7
- assert.strict.equal(1, 1);
8
- assert.strict.deepEqual([1], [2]);
9
- t.pass('Pass #2');
10
- });
@@ -1,7 +0,0 @@
1
- import test from 'tape-six';
2
- import process from 'node:process';
3
-
4
- test('bad exit', t => {
5
- t.pass();
6
- process.exit(1);
7
- });
@@ -1,7 +0,0 @@
1
- import test from 'tape-six';
2
-
3
- import x from 'bad-import';
4
-
5
- test('non-working test', t => {
6
- t.ok(typeof x === 'object');
7
- });
@@ -1,7 +0,0 @@
1
- import test from 'tape-six';
2
- import process from 'node:process';
3
-
4
- test('bad signal', t => {
5
- t.pass();
6
- process.kill(process.pid, 'SIGKILL');
7
- });
@@ -1,16 +0,0 @@
1
- import {expect, assert} from 'chai';
2
- import test from 'tape-six';
3
-
4
- test('Using Chai expect', t => {
5
- t.pass('Pass #1');
6
- expect([1]).to.deep.equal([1]);
7
- expect([1]).to.deep.equal([2]);
8
- t.pass('Pass #2');
9
- });
10
-
11
- test('Using Chai assert', t => {
12
- t.pass('Pass #1');
13
- assert.deepEqual([1], [1]);
14
- assert.deepEqual([1], [2], '1 should be equal to 2!');
15
- t.pass('Pass #2');
16
- });
@@ -1,11 +0,0 @@
1
- import assert from 'node:assert';
2
- import test from 'tape-six';
3
-
4
- test('Using standard assert', t => {
5
- t.pass('Pass #1');
6
- assert.strict.equal(1, 1);
7
- t.throws(() => {
8
- assert.strict.deepEqual([1], [2]);
9
- });
10
- t.pass('Pass #2');
11
- });
@@ -1,20 +0,0 @@
1
- import {expect, assert} from 'chai';
2
- import test from 'tape-six';
3
-
4
- test('Using Chai expect', t => {
5
- t.pass('Pass #1');
6
- expect([1]).to.deep.equal([1]);
7
- t.throws(() => {
8
- expect([1]).to.deep.equal([2]);
9
- });
10
- t.pass('Pass #2');
11
- });
12
-
13
- test('Using Chai assert', t => {
14
- t.pass('Pass #1');
15
- assert.deepEqual([1], [1]);
16
- t.throws(() => {
17
- assert.deepEqual([1], [2], '1 should be equal to 2!');
18
- });
19
- t.pass('Pass #2');
20
- });
@@ -1,12 +0,0 @@
1
- import test from 'tape-six';
2
-
3
- test('console test', t => {
4
- console.log('#1');
5
- t.pass();
6
- console.log('#2');
7
- console.error('error #1');
8
- console.log('#2a');
9
- t.ok(1 < 2);
10
- console.log('#3');
11
- console.error('error #2');
12
- });
package/wiki/Home.md DELETED
@@ -1,30 +0,0 @@
1
- <!-- markdownlint-disable-next-line first-line-heading -->
2
-
3
- `tape-six-proc` is a helper for [tape-six](https://www.npmjs.com/package/tape-six)
4
- to run tests in separate processes.
5
-
6
- Please consult the [tape-six wiki](https://github.com/uhop/tape-six/wiki) for more information.
7
-
8
- # How to use
9
-
10
- 1. Install `tape-six-proc` in your project: `npm i -D tape-six-proc`.
11
- 2. Write tests.
12
- 3. Configure your tests: [set-up tests](https://github.com/uhop/tape-six/wiki/Set-up-tests).
13
- 4. Run tests: `npm test`.
14
-
15
- # Available utilities
16
-
17
- Test files are directly executable with `node` or `deno` or `bun` or in a browser.
18
- [tape-six](https://www.npmjs.com/package/tape-six) helps to organize tests. This package
19
- provides a utility to run tests in isolated processes:
20
-
21
- - [tape6-proc](./Utility-‐-tape6‐proc) to run tests in separate processes.
22
-
23
- # Formalities
24
-
25
- The project is distributed under the 3-clause BSD license.
26
-
27
- Other pertinent information:
28
-
29
- - [Release notes](./Release-notes).
30
- - [Working on this project](./Working-on-this-project).
@@ -1,21 +0,0 @@
1
- # The current version: 1.x
2
-
3
- - 1.2.2 _Synchronized the implementation with `tape-six` 1.7.0._
4
- - 1.2.1 _Synchronized the implementation with `tape-six` 1.5.1._
5
- - 1.2.0 _Updated dependencies and synchronized the implementation with `tape-six` 1.5.0._
6
- - 1.1.6 _Updated dependencies._
7
- - 1.1.5 _Updated dependencies._
8
- - 1.1.4 _Updated dependencies._
9
- - 1.1.3 _Updated dependencies._
10
- - 1.1.2 _Fixed bug with Deno (spawned process can end before processing streams (stdout/stderr))._
11
- - 1.1.1 _Updated dependencies._
12
- - 1.1.0 _Added support for stdout/stderr and `tape-six` 1.3.4._
13
- - 1.0.2 _Fixed concurrency detection. Updated dependencies._
14
- - 1.0.1 _Updated dependencies._
15
- - 1.0.0 _The first official release._
16
-
17
- # The previous releases
18
-
19
- - 0.12.1 _Updated dependencies, which included fixes for Deno._
20
- - 0.12.0 _Initial release._
21
- - 1.1.3 _Updated dependencies._
@@ -1,69 +0,0 @@
1
- <!-- markdownlint-disable-next-line first-line-heading -->
2
-
3
- The main utility of the package is `tape6-proc`.
4
-
5
- # Usage
6
-
7
- Assuming that the tests are properly configured (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 [tape6](https://github.com/uhop/tape-six/wiki/Utility-%E2%80%90-tape6).
20
-
21
- Additionally it supports the following flags:
22
-
23
- - `--runFileArgs ARGS` &mdash; sets the arguments to pass to the interpreter running test files.
24
- - Shortcut: `-r ARGS`.
25
- - This flag can be used multiple times.
26
-
27
- This flag is used mostly with Deno to supply additional arguments to the test file. On Deno and Bun these arguments will follow the `run` command.
28
-
29
- For example, we want to add `-A` (`--allow-all` permissions) to run a test file:
30
-
31
- ```bash
32
- deno run -A `npx tape6-proc --self` --runFileArgs -A
33
- ```
34
-
35
- We can use it multiple times to supply several arguments, e.g., fine grained permissions:
36
-
37
- ```bash
38
- deno run -A `npx tape6-proc --self` -r --allow-read -r --allow-env
39
- ```
40
-
41
- # Implementation details
42
-
43
- Technically, `tape6-proc` is an executable command-line utility, which is set to be executed with
44
- the current Node. If you want to use it in different environments, you can use the `--self` flag:
45
-
46
- Example of `package.json`:
47
-
48
- ```jsonc
49
- {
50
- "scripts": {
51
- "test": "tape6-proc --flags FO",
52
- "test:node": "tape6-proc --flags FO",
53
- "test:bun": "bun run `npx tape6-proc --self` --flags FO",
54
- "test:deno": "deno run -A `npx tape6-proc --self` --flags FO -r -A"
55
- }
56
- }
57
- ```
58
-
59
- With scripts like above you can test your project in different environments:
60
-
61
- ```bash
62
- npm test
63
- npm run test:bun
64
- npm run test:deno
65
- ```
66
-
67
- ## Test environment
68
-
69
- All environments spawn child processes to run tests using [dollar-shell](https://www.npmjs.com/package/dollar-shell).
@@ -1,23 +0,0 @@
1
- <!-- markdownlint-disable-next-line first-line-heading -->
2
-
3
- This project uses git submodules, so the correct way to get it is:
4
-
5
- ```bash
6
- git clone --recursive git@github.com:uhop/tape-six-proc.git
7
- cd tape-six-proc
8
- ```
9
-
10
- For older versions of `git`:
11
-
12
- ```bash
13
- git clone git@github.com:uhop/tape-six-proc.git
14
- cd tape-six-proc
15
- git submodule update --init --recursive
16
- ```
17
-
18
- Don't forget to install dependencies and run a build:
19
-
20
- ```bash
21
- npm install
22
- npm run build
23
- ```