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 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), except you can also put `pty: true` in `options` to launch the process using a psuedoterminal (useful for testing color output).
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
@@ -8,7 +8,6 @@ export type Options = {
8
8
  shell?: boolean | string;
9
9
  windowsVerbatimArguments?: boolean;
10
10
  windowsHide?: boolean;
11
- pty?: boolean;
12
11
  };
13
12
 
14
13
  export type RunContext = {
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
- child = ptySpawn(cmd, args, options);
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
- stdout.on("data", function (data) {
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;
@@ -9,7 +9,6 @@ export type Options = {
9
9
  shell?: ?boolean | string,
10
10
  windowsVerbatimArguments?: ?boolean,
11
11
  windowsHide?: ?boolean,
12
- pty?: ?boolean,
13
12
  };
14
13
 
15
14
  export type RunContext = {
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "first-base",
3
- "version": "0.1.2",
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": {