first-base 1.6.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/index.js.flow +1 -1
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ An object with the following properties on it:
|
|
|
32
32
|
- `stdout` (`string`): All the data the process has written to STDOUT so far
|
|
33
33
|
- `stderr` (`string`): All the data the process has written to STDERR so far
|
|
34
34
|
- `code` (`number | null`): Exit status code, if the process has finished
|
|
35
|
-
- `error` (`
|
|
35
|
+
- `error` (`null | Error`): If the process errored out, this is the Error
|
|
36
36
|
|
|
37
37
|
This object gets updated over time as the process runs.
|
|
38
38
|
|
|
@@ -40,9 +40,9 @@ This object gets updated over time as the process runs.
|
|
|
40
40
|
|
|
41
41
|
```js
|
|
42
42
|
const run = spawn("ls", { cwd: __dirname });
|
|
43
|
-
console.log(run.result); // { stdout: '', stderr: '', code: null, error:
|
|
43
|
+
console.log(run.result); // { stdout: '', stderr: '', code: null, error: null }
|
|
44
44
|
await run.completion;
|
|
45
|
-
console.log(run.result); // { stdout: 'README.md\npackage.json\nindex.js\n', stderr: '', code: 0, error:
|
|
45
|
+
console.log(run.result); // { stdout: 'README.md\npackage.json\nindex.js\n', stderr: '', code: 0, error: null }
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
### `RunContext#completion`
|
|
@@ -70,7 +70,7 @@ const run = spawn("ls", { cwd: __dirname }).debug();
|
|
|
70
70
|
//
|
|
71
71
|
// STDOUT: README.md\npackage.json\nindex.js
|
|
72
72
|
// Process exited
|
|
73
|
-
// { stdout: 'README.md\npackage.json\nindex.js', stderr: '', code: 0, error:
|
|
73
|
+
// { stdout: 'README.md\npackage.json\nindex.js', stderr: '', code: 0, error: null }
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
### `RunContext#outputContains(value: string | RegExp) => Promise<void>`
|
|
@@ -173,3 +173,13 @@ It may be beneficial to clean these up in a test timeout handler or etc.
|
|
|
173
173
|
## License
|
|
174
174
|
|
|
175
175
|
MIT
|
|
176
|
+
|
|
177
|
+
## Upgrading from 1.x
|
|
178
|
+
|
|
179
|
+
The only things that changed between 1.x and 2.0 are:
|
|
180
|
+
|
|
181
|
+
- The `error` property of a `RunContext` changed from `boolean` to `null | Error`
|
|
182
|
+
- We switched node-pty fork to a prebuilt one instead of an install-time compiled node-gyp one, which has the side-effect that we only support the following platforms:
|
|
183
|
+
- Linux arm64 and x86_64
|
|
184
|
+
- macOS arm64 and x86_64
|
|
185
|
+
- Windows arm64 and x86_64
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type RunContext = {
|
|
|
16
16
|
stdout: string;
|
|
17
17
|
stderr: string;
|
|
18
18
|
code: null | number;
|
|
19
|
-
error:
|
|
19
|
+
error: null | Error;
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
22
|
* Same as {@link RunContext.result}, but with {@link sanitizers} run on
|
|
@@ -26,7 +26,7 @@ export type RunContext = {
|
|
|
26
26
|
stdout: string;
|
|
27
27
|
stderr: string;
|
|
28
28
|
code: null | number;
|
|
29
|
-
error:
|
|
29
|
+
error: null | Error;
|
|
30
30
|
};
|
|
31
31
|
completion: Promise<void>;
|
|
32
32
|
debug(): RunContext;
|
package/dist/index.js
CHANGED
|
@@ -50,8 +50,8 @@ var spawn = function spawn(cmd, argsOrOptions, passedOptions) {
|
|
|
50
50
|
stderr: "",
|
|
51
51
|
// Exit status code, if the process has finished.
|
|
52
52
|
code: null,
|
|
53
|
-
//
|
|
54
|
-
error:
|
|
53
|
+
// if the process errored out, this will be the Error
|
|
54
|
+
error: null
|
|
55
55
|
},
|
|
56
56
|
// Return a version of result which has had the string sanitizers run on it
|
|
57
57
|
cleanResult: function cleanResult() {
|
|
@@ -134,7 +134,7 @@ var spawn = function spawn(cmd, argsOrOptions, passedOptions) {
|
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
136
|
if (options.pty) {
|
|
137
|
-
var ptySpawn = require("node-pty").spawn;
|
|
137
|
+
var ptySpawn = require("@lydell/node-pty").spawn;
|
|
138
138
|
child = ptySpawn(cmd, args, options);
|
|
139
139
|
stdin = child;
|
|
140
140
|
stdout = child;
|
|
@@ -203,8 +203,8 @@ var spawn = function spawn(cmd, argsOrOptions, passedOptions) {
|
|
|
203
203
|
runContext.result.code = code;
|
|
204
204
|
finish("exited");
|
|
205
205
|
});
|
|
206
|
-
child.once("error", function () {
|
|
207
|
-
runContext.result.error =
|
|
206
|
+
child.once("error", function (error) {
|
|
207
|
+
runContext.result.error = error;
|
|
208
208
|
finish("errored");
|
|
209
209
|
});
|
|
210
210
|
});
|
package/dist/index.js.flow
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "first-base",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Integration testing for CLI applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -10,11 +10,9 @@
|
|
|
10
10
|
"author": "Lily Skye <me@suchipi.com>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"
|
|
14
|
-
"nice-path": "^3.2.2"
|
|
15
|
-
|
|
16
|
-
"optionalDependencies": {
|
|
17
|
-
"node-pty": "^1.0.0"
|
|
13
|
+
"@lydell/node-pty": "^1.2.0-beta.3",
|
|
14
|
+
"nice-path": "^3.2.2",
|
|
15
|
+
"strip-ansi": "^5.0.0"
|
|
18
16
|
},
|
|
19
17
|
"devDependencies": {
|
|
20
18
|
"@babel/cli": "^7.28.6",
|