first-base 0.1.2 → 0.2.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 +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +15 -11
- package/dist/index.js.flow +0 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ test("something", async () => {
|
|
|
21
21
|
|
|
22
22
|
### `spawn(command: string, args?: Array<string>, options?: Object) => RunContext`
|
|
23
23
|
|
|
24
|
-
`args` and `options` are the same as [child_process.spawn](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options)
|
|
24
|
+
`args` and `options` are the same as [child_process.spawn](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).
|
|
25
25
|
|
|
26
26
|
Returns a `RunContext` object; see below.
|
|
27
27
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -4,8 +4,6 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
|
|
|
4
4
|
|
|
5
5
|
var normalSpawn = require("child_process").spawn;
|
|
6
6
|
|
|
7
|
-
var ptySpawn = require("node-pty").spawn;
|
|
8
|
-
|
|
9
7
|
var stripAnsi = require("strip-ansi"); // Run a child process and return a "run context" object
|
|
10
8
|
// to interact with it. Function signature is the same as
|
|
11
9
|
// child_process spawn, except you can pass `pty: true` in
|
|
@@ -114,12 +112,7 @@ var spawn = function spawn(cmd, argsOrOptions, passedOptions) {
|
|
|
114
112
|
};
|
|
115
113
|
|
|
116
114
|
if (options.pty) {
|
|
117
|
-
|
|
118
|
-
stdin = child;
|
|
119
|
-
stdout = child;
|
|
120
|
-
stderr = null; // no way to tell between stdout and stderr with pty
|
|
121
|
-
|
|
122
|
-
unreffable = child.socket;
|
|
115
|
+
throw new Error("pty mode is no longer supported due to lack of support for new node.js versions in the node-pty module");
|
|
123
116
|
} else {
|
|
124
117
|
child = normalSpawn(cmd, args, options);
|
|
125
118
|
stdin = child.stdin;
|
|
@@ -145,15 +138,26 @@ var spawn = function spawn(cmd, argsOrOptions, passedOptions) {
|
|
|
145
138
|
};
|
|
146
139
|
|
|
147
140
|
stdout.setEncoding("utf-8");
|
|
148
|
-
|
|
141
|
+
|
|
142
|
+
var handleStdoutData = function handleStdoutData(data) {
|
|
149
143
|
runContext.result.stdout += data;
|
|
150
144
|
outputContainsBuffer += data;
|
|
151
145
|
debugLog("STDOUT: ".concat(data.toString()));
|
|
152
146
|
checkForPendingOutputRequestsToResolve();
|
|
153
|
-
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
if (stdout.onData) {
|
|
150
|
+
// the pty instance returned by node-pty
|
|
151
|
+
// requires attaching handlers differently
|
|
152
|
+
stdout.onData(handleStdoutData);
|
|
153
|
+
} else {
|
|
154
|
+
stdout.on("data", handleStdoutData);
|
|
155
|
+
}
|
|
154
156
|
|
|
155
157
|
if (stderr) {
|
|
156
|
-
stderr.setEncoding("utf-8");
|
|
158
|
+
stderr.setEncoding("utf-8"); // this is never a pty instance,
|
|
159
|
+
// so we don't need to deal with onData here:
|
|
160
|
+
|
|
157
161
|
stderr.on("data", function (data) {
|
|
158
162
|
runContext.result.stderr += data;
|
|
159
163
|
outputContainsBuffer += data;
|
package/dist/index.js.flow
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "first-base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Integration testing for CLI applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": "https://github.com/suchipi/first-base",
|
|
7
7
|
"author": "Lily Scott <me@suchipi.com>",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"node-pty": "^0.8.0",
|
|
11
10
|
"strip-ansi": "^5.0.0"
|
|
12
11
|
},
|
|
13
12
|
"devDependencies": {
|