tape-six-proc 1.1.0 → 1.1.2

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,11 +22,11 @@ has the same usage as `tape6`.
22
22
 
23
23
  The most recent releases:
24
24
 
25
+ - 1.1.2 _Fixed bug with Deno (spawned process can end before processing streams (stdout/stderr))._
26
+ - 1.1.1 _Updated dependencies._
25
27
  - 1.1.0 _Added support for stdout/stderr and `tape-six` 1.3.4._
26
28
  - 1.0.2 _Fixed concurrency detection. Updated dependencies._
27
29
  - 1.0.1 _Updated dependencies._
28
30
  - 1.0.0 _The first official release._
29
- - 0.12.1 _Updated dependencies, which included fixes for Deno._
30
- - 0.12.0 _Initial release._
31
31
 
32
32
  For more info consult full [release notes](https://github.com/uhop/tape-six-proc/wiki/Release-notes).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tape-six-proc",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
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": {
@@ -33,7 +33,7 @@
33
33
  "homepage": "https://github.com/uhop/tape-six-proc#readme",
34
34
  "dependencies": {
35
35
  "dollar-shell": "^1.1.0",
36
- "tape-six": "^1.3.4"
36
+ "tape-six": "^1.4.1"
37
37
  },
38
38
  "tape6": {
39
39
  "tests": [
package/src/TestWorker.js CHANGED
@@ -8,10 +8,11 @@ import {spawn, currentExecPath, runFileArgs} from 'dollar-shell';
8
8
 
9
9
  import {StopTest} 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
12
 
12
- import lines from './chain/lines.js';
13
- import parse from './chain/parse-prefixed-jsonl.js';
14
- import wrap from './chain/wrap-lines.js';
13
+ import lines from './streams/lines.js';
14
+ import parse from './streams/parse-prefixed-jsonl.js';
15
+ import wrap from './streams/wrap-lines.js';
15
16
 
16
17
  const baseName = pathToFileURL(process.cwd() + sep);
17
18
 
@@ -42,6 +43,7 @@ export default class TestWorker extends EventServer {
42
43
  );
43
44
  this.idToWorker[id] = worker;
44
45
  const self = this;
46
+ const stdoutDeferred = getDeferred();
45
47
  worker.stdout
46
48
  .pipeThrough(new TextDecoderStream())
47
49
  .pipeThrough(lines())
@@ -56,9 +58,13 @@ export default class TestWorker extends EventServer {
56
58
  throw error;
57
59
  }
58
60
  }
61
+ },
62
+ close() {
63
+ stdoutDeferred.resolve();
59
64
  }
60
65
  })
61
66
  );
67
+ const stderrDeferred = getDeferred();
62
68
  worker.stderr
63
69
  .pipeThrough(new TextDecoderStream())
64
70
  .pipeThrough(lines())
@@ -67,10 +73,13 @@ export default class TestWorker extends EventServer {
67
73
  new WritableStream({
68
74
  write(msg) {
69
75
  self.report(id, msg);
76
+ },
77
+ close() {
78
+ stderrDeferred.resolve();
70
79
  }
71
80
  })
72
81
  );
73
- worker.exited.finally(() => self.close(id));
82
+ Promise.all([worker.exited, stdoutDeferred.promise, stderrDeferred.promise]).finally(() => self.close(id));
74
83
  return id;
75
84
  }
76
85
  destroyTask(id) {
@@ -1,8 +1,13 @@
1
1
  # The current version: 1.x
2
2
 
3
+ - 1.1.2 _Fixed bug with Deno (spawned process can end before processing streams (stdout/stderr))._
4
+ - 1.1.1 _Updated dependencies._
3
5
  - 1.1.0 _Added support for stdout/stderr and `tape-six` 1.3.4._
4
6
  - 1.0.2 _Fixed concurrency detection. Updated dependencies._
5
7
  - 1.0.1 _Updated dependencies._
6
8
  - 1.0.0 _The first official release._
9
+
10
+ # The previous releases
11
+
7
12
  - 0.12.1 _Updated dependencies, which included fixes for Deno._
8
13
  - 0.12.0 _Initial release._
@@ -4,8 +4,7 @@ The main utility of the package is `tape6-proc`.
4
4
 
5
5
  # Usage
6
6
 
7
- Assuming that the tests are properly configured
8
- (see [Set-up tests](https://github.com/uhop/tape-six/wiki/Set-up-tests)),
7
+ Assuming that the tests are properly configured (see [Set-up tests](https://github.com/uhop/tape-six/wiki/Set-up-tests)),
9
8
  it can be invoked without arguments:
10
9
 
11
10
  ```bash
@@ -17,16 +16,15 @@ and can be used the same way.
17
16
 
18
17
  # Configuring `tape6-proc`
19
18
 
20
- `tape6-proc` supports the same configuration as
21
- [tape6](https://github.com/uhop/tape-six/wiki/Utility-%E2%80%90-tape6).
19
+ `tape6-proc` supports the same configuration as [tape6](https://github.com/uhop/tape-six/wiki/Utility-%E2%80%90-tape6).
22
20
 
23
21
  Additionally it supports the following flags:
24
22
 
25
- - `--runFileArgs ARGS` — sets the arguments to pass to the test file.
23
+ - `--runFileArgs ARGS` — sets the arguments to pass to the interpreter running test files.
26
24
  - Shortcut: `-r ARGS`.
27
25
  - This flag can be used multiple times.
28
26
 
29
- This flag is used mostly with Deno to supply additional arguments to the test file.
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.
30
28
 
31
29
  For example, we want to add `-A` (`--allow-all` permissions) to run a test file:
32
30
 
@@ -34,6 +32,12 @@ For example, we want to add `-A` (`--allow-all` permissions) to run a test file:
34
32
  deno run -A `npx tape6-proc --self` --runFileArgs -A
35
33
  ```
36
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
+
37
41
  # Implementation details
38
42
 
39
43
  Technically, `tape6-proc` is an executable command-line utility, which is set to be executed with
@@ -47,7 +51,7 @@ Example of `package.json`:
47
51
  "test": "tape6-proc --flags FO",
48
52
  "test:node": "tape6-proc --flags FO",
49
53
  "test:bun": "bun run `npx tape6-proc --self` --flags FO",
50
- "test:deno": "deno run -A `npx tape6-proc --self` --flags FO --runFileArgs -A"
54
+ "test:deno": "deno run -A `npx tape6-proc --self` --flags FO -r -A"
51
55
  }
52
56
  }
53
57
  ```
@@ -62,5 +66,4 @@ npm run test:deno
62
66
 
63
67
  ## Test environment
64
68
 
65
- All environments spawn child processes to run tests using
66
- [dollar-shell](https://www.npmjs.com/package/dollar-shell).
69
+ All environments spawn child processes to run tests using [dollar-shell](https://www.npmjs.com/package/dollar-shell).
File without changes
File without changes
File without changes