tape-six-proc 1.2.1 → 1.2.3

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,93 @@
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
14
+ state leaks and is useful when tests need a clean environment. TypeScript test files
15
+ (`.ts`) are run natively by 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
69
  The documentation can be found in the [wiki](https://github.com/uhop/tape-six-proc/wiki).
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`
72
+ `tape-six-proc` uses the same test configuration as `tape-six`. The utility `tape6-proc`
15
73
  has the same usage as `tape6`.
16
74
 
17
75
  ### Command-line utilities
18
76
 
19
77
  - [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
78
 
79
+ ## AI agents
80
+
81
+ If you are an AI coding agent, see [AGENTS.md](./AGENTS.md) for project conventions, commands, and architecture.
82
+
83
+ LLM-friendly documentation is available:
84
+
85
+ - [llms.txt](./llms.txt) — concise reference.
86
+ - [llms-full.txt](./llms-full.txt) — full reference with architecture details.
87
+
21
88
  ## Release notes
22
89
 
23
90
  The most recent releases:
24
91
 
92
+ - 1.2.3 _Updated dependencies, cleaned up docs, added AI-friendly links and TS info._
93
+ - 1.2.2 _Synchronized the implementation with `tape-six` 1.7.0._
25
94
  - 1.2.1 _Synchronized the implementation with `tape-six` 1.5.1._
26
95
  - 1.2.0 _Updated dependencies and synchronized the implementation with `tape-six` 1.5.0._
27
96
  - 1.1.6 _Updated dependencies._
@@ -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
 
@@ -148,10 +146,15 @@ const main = async () => {
148
146
  console.error('UNHANDLED ERROR:', origin, error)
149
147
  );
150
148
 
149
+ if (!files.length) {
150
+ console.log('No files found.');
151
+ process.exit(1);
152
+ }
153
+
151
154
  const reporter = getReporter(),
152
155
  worker = new TestWorker(reporter, parallel, options);
153
156
 
154
- reporter.report({type: 'test', test: 0, name: ''});
157
+ reporter.report({type: 'test', test: 0});
155
158
 
156
159
  await new Promise(resolve => {
157
160
  worker.done = () => resolve();
package/llms-full.txt ADDED
@@ -0,0 +1,236 @@
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), and JSONL 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_TEST` — set by the runner: unique ID for each spawned test process.
149
+ - `TAPE6_TEST_FILE_NAME` — set by the runner: file name of the current test.
150
+ - `TAPE6_JSONL_PREFIX` — set by the runner: UUID prefix for JSONL lines in stdout.
151
+
152
+ ## Architecture
153
+
154
+ ### Entry point
155
+
156
+ `bin/tape6-proc.js` is the CLI entry point:
157
+
158
+ - With `--self`: prints its own absolute path and exits.
159
+ - Otherwise: delegates to `bin/tape6-proc-node.js`.
160
+
161
+ ### Main CLI (`bin/tape6-proc-node.js`)
162
+
163
+ 1. Parses CLI arguments (`--flags`, `--par`, `--runFileArgs`, positional test patterns).
164
+ 2. Selects reporter: TTY (default for terminals), TAP, or JSONL (based on environment variables).
165
+ 3. Resolves test files from configuration or CLI patterns using `tape-six/utils/config.js`.
166
+ 4. Creates a `TestWorker` instance and executes all test files.
167
+ 5. Reports final results and exits with code 0 (success) or 1 (failures).
168
+
169
+ ### TestWorker (`src/TestWorker.js`)
170
+
171
+ Extends `EventServer` from `tape-six`. Manages parallel subprocess execution:
172
+
173
+ - **`constructor(reporter, numberOfTasks, options)`** — initializes with a reporter, concurrency limit, and options. Generates a UUID prefix for JSONL parsing.
174
+ - **`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.
175
+ - **`destroyTask(id)`** — cleans up a completed task.
176
+ - **`getConcurrency()`** — static method, returns available CPU cores.
177
+
178
+ ### Stream pipeline
179
+
180
+ Each spawned process has two stream pipelines:
181
+
182
+ **stdout pipeline:**
183
+ ```
184
+ process.stdout → TextDecoderStream → lines → parse-prefixed-jsonl → report
185
+ ```
186
+
187
+ - `lines` (`src/streams/lines.js`): TransformStream that splits text into individual lines.
188
+ - `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.
189
+
190
+ **stderr pipeline:**
191
+ ```
192
+ process.stderr → TextDecoderStream → lines → wrap-lines → report
193
+ ```
194
+
195
+ - `wrap-lines` (`src/streams/wrap-lines.js`): TransformStream that wraps each line as `{type: 'stderr', name: line}`.
196
+
197
+ ### Process lifecycle
198
+
199
+ 1. Process is spawned with environment variables: `TAPE6_FLAGS`, `TAPE6_TEST`, `TAPE6_TEST_FILE_NAME`, `TAPE6_JSONL=Y`, `TAPE6_JSONL_PREFIX`.
200
+ 2. The test file runs and outputs JSONL-prefixed lines to stdout.
201
+ 3. After the process exits, `TestWorker` checks exit code and signal.
202
+ 4. Non-zero exit codes are reported as errors with a `{type: 'terminated'}` event.
203
+ 5. The task is closed and the next queued test file starts.
204
+
205
+ ## Dependencies
206
+
207
+ - **`tape-six`** — the core test library. Imports: `State.js`, `utils/EventServer.js`, `utils/makeDeferred.js`, `utils/config.js`, `test.js`, reporters (`TapReporter`, `TTYReporter`, `JSONLReporter`), `utils/timer.js`.
208
+ - **`dollar-shell`** — cross-runtime process spawning. Imports: `spawn`, `currentExecPath`, `runFileArgs`.
209
+
210
+ ## Writing tests
211
+
212
+ Tests are standard `tape-six` tests. See the [tape-six documentation](https://github.com/uhop/tape-six/wiki) for the full API.
213
+
214
+ ```js
215
+ import test from 'tape-six';
216
+
217
+ test('arithmetic', t => {
218
+ t.equal(2 + 2, 4, 'addition');
219
+ t.ok(10 > 5, 'comparison');
220
+ });
221
+
222
+ test('async operation', async t => {
223
+ const result = await fetchData();
224
+ t.ok(result, 'got result');
225
+ t.equal(result.status, 200, 'status is 200');
226
+ });
227
+ ```
228
+
229
+ Test files should be directly executable: `node tests/test-foo.js` or `node tests/test-foo.ts`
230
+
231
+ ## Links
232
+
233
+ - Docs: https://github.com/uhop/tape-six-proc/wiki
234
+ - npm: https://www.npmjs.com/package/tape-six-proc
235
+ - tape-six: https://github.com/uhop/tape-six
236
+ - tape-six LLM reference: https://github.com/uhop/tape-six/blob/master/llms.txt
package/llms.txt ADDED
@@ -0,0 +1,107 @@
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).
55
+ - `--par N` (`-p`) — number of parallel processes (default: all CPU cores).
56
+ - `--runFileArgs ARGS` (`-r`) — extra arguments passed to the spawned interpreter. Can be used 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_TEST_FILE_NAME` — set by the runner to identify the current test file.
101
+
102
+ ## Links
103
+
104
+ - Docs: https://github.com/uhop/tape-six-proc/wiki
105
+ - npm: https://www.npmjs.com/package/tape-six-proc
106
+ - tape-six: https://github.com/uhop/tape-six
107
+ - 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.1",
4
- "description": "Helper for TAP the test harness for the modern JavaScript (ES6) to run tests in separate processes.",
3
+ "version": "1.2.3",
4
+ "description": "Helper for tape-six to run tests in separate processes. 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"
@@ -9,16 +9,28 @@
9
9
  "scripts": {
10
10
  "lint": "prettier --check .",
11
11
  "lint:fix": "prettier --write .",
12
- "test": "node ./bin/tape6-proc.js",
13
- "test:bun": "bun run ./bin/tape6-proc.js",
14
- "test:deno": "deno run -A ./bin/tape6-proc.js -r --allow-read -r --allow-env"
12
+ "test": "node ./bin/tape6-proc.js --flags FO",
13
+ "test:bun": "bun run ./bin/tape6-proc.js --flags FO",
14
+ "test:deno": "deno run -A ./bin/tape6-proc.js -r --allow-read -r --allow-env --flags FO"
15
15
  },
16
16
  "keywords": [
17
17
  "tap",
18
18
  "test",
19
19
  "harness",
20
20
  "assert",
21
- "process"
21
+ "process",
22
+ "unit-test",
23
+ "testing",
24
+ "test-runner",
25
+ "esm",
26
+ "es-modules",
27
+ "deno",
28
+ "bun",
29
+ "nodejs",
30
+ "cross-runtime",
31
+ "subprocess",
32
+ "isolated-process",
33
+ "typescript"
22
34
  ],
23
35
  "author": "Eugene Lazutkin <eugene.lazutkin@gmail.com> (https://www.lazutkin.com)",
24
36
  "funding": "https://github.com/sponsors/uhop",
@@ -31,13 +43,25 @@
31
43
  "url": "https://github.com/uhop/tape-six-proc/issues"
32
44
  },
33
45
  "homepage": "https://github.com/uhop/tape-six-proc#readme",
46
+ "github": "http://github.com/uhop/tape-six-proc",
47
+ "llms": "https://raw.githubusercontent.com/uhop/tape-six-proc/master/llms.txt",
48
+ "llmsFull": "https://raw.githubusercontent.com/uhop/tape-six-proc/master/llms-full.txt",
49
+ "files": [
50
+ "bin",
51
+ "src",
52
+ "llms.txt",
53
+ "llms-full.txt"
54
+ ],
34
55
  "dependencies": {
35
- "dollar-shell": "^1.1.7",
36
- "tape-six": "^1.5.1"
56
+ "dollar-shell": "^1.1.9",
57
+ "tape-six": "^1.7.2"
37
58
  },
38
59
  "tape6": {
39
60
  "tests": [
40
61
  "/tests/test-*.*js"
41
62
  ]
63
+ },
64
+ "devDependencies": {
65
+ "chai": "^6.2.2"
42
66
  }
43
67
  }
package/src/TestWorker.js CHANGED
@@ -8,7 +8,7 @@ import {spawn, currentExecPath, runFileArgs} from 'dollar-shell';
8
8
 
9
9
  import {isStopTest} from 'tape-six/State.js';
10
10
  import EventServer from 'tape-six/utils/EventServer.js';
11
- import getDeferred from 'tape-six/utils/getDeferred.js';
11
+ import makeDeferred from 'tape-six/utils/makeDeferred.js';
12
12
 
13
13
  import lines from './streams/lines.js';
14
14
  import parse from './streams/parse-prefixed-jsonl.js';
@@ -44,7 +44,7 @@ export default class TestWorker extends EventServer {
44
44
  );
45
45
  this.idToWorker[id] = worker;
46
46
  const self = this;
47
- const stdoutDeferred = getDeferred();
47
+ const stdoutDeferred = makeDeferred();
48
48
  worker.stdout
49
49
  .pipeThrough(new TextDecoderStream())
50
50
  .pipeThrough(lines())
@@ -66,7 +66,7 @@ export default class TestWorker extends EventServer {
66
66
  }
67
67
  })
68
68
  );
69
- const stderrDeferred = getDeferred();
69
+ const stderrDeferred = makeDeferred();
70
70
  worker.stderr
71
71
  .pipeThrough(new TextDecoderStream())
72
72
  .pipeThrough(lines())
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,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,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,20 +0,0 @@
1
- # The current version: 1.x
2
-
3
- - 1.2.1 _Synchronized the implementation with `tape-six` 1.5.1._
4
- - 1.2.0 _Updated dependencies and synchronized the implementation with `tape-six` 1.5.0._
5
- - 1.1.6 _Updated dependencies._
6
- - 1.1.5 _Updated dependencies._
7
- - 1.1.4 _Updated dependencies._
8
- - 1.1.3 _Updated dependencies._
9
- - 1.1.2 _Fixed bug with Deno (spawned process can end before processing streams (stdout/stderr))._
10
- - 1.1.1 _Updated dependencies._
11
- - 1.1.0 _Added support for stdout/stderr and `tape-six` 1.3.4._
12
- - 1.0.2 _Fixed concurrency detection. Updated dependencies._
13
- - 1.0.1 _Updated dependencies._
14
- - 1.0.0 _The first official release._
15
-
16
- # The previous releases
17
-
18
- - 0.12.1 _Updated dependencies, which included fixes for Deno._
19
- - 0.12.0 _Initial release._
20
- - 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
- ```