Comparing version 5.2.2 to 5.3.0
5.3.0 / 2020-04-22 | ||
================== | ||
**features** | ||
* [[`462c583`](http://github.com/node-modules/coffee/commit/462c5837246a9b4d0fd757f4982f1c3cafb95ce4)] - feat: support on event (#80) (TZ | 天猪 <<atian25@qq.com>>) | ||
5.2.2 / 2019-07-30 | ||
@@ -3,0 +9,0 @@ ================== |
import { EventEmitter } from 'events'; | ||
import { ForkOptions, SpawnOptions } from 'child_process'; | ||
import { ForkOptions, SpawnOptions, ChildProcess } from 'child_process'; | ||
import { Readable } from 'stream'; | ||
@@ -26,2 +26,3 @@ | ||
error: Error | null; | ||
proc: ChildProcess | null; | ||
} | ||
@@ -28,0 +29,0 @@ |
@@ -61,2 +61,3 @@ 'use strict'; | ||
this.stdout += buf; | ||
this.emit('stdout', buf.toString()); | ||
}); | ||
@@ -67,2 +68,3 @@ this.on('stderr_data', buf => { | ||
this.stderr += buf; | ||
this.emit('stderr', buf.toString()); | ||
}); | ||
@@ -86,2 +88,3 @@ this.on('error', err => { | ||
error: this.error, | ||
proc: this.proc, | ||
}; | ||
@@ -91,2 +94,3 @@ this.emit('complete_success', result); | ||
} catch (err) { | ||
err.proc = this.proc; | ||
this.emit('complete_error', err); | ||
@@ -273,2 +277,3 @@ return this.cb && this.cb(err); | ||
debug(`coffee exit with ${code}`); | ||
cmd.exitCode = code; | ||
cmd.kill(); | ||
@@ -275,0 +280,0 @@ }); |
{ | ||
"name": "coffee", | ||
"version": "5.2.2", | ||
"version": "5.3.0", | ||
"description": "Test command line on Node.js.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -284,2 +284,17 @@ # Coffee | ||
#### coffee.on(event, callback) | ||
Emit `stdout/stderr` event. | ||
```js | ||
coffee.fork('path/to/cli') | ||
.on('stdout', function (buf) { | ||
if (buf.toString().includes('egg-ready')) { | ||
this.proc.kill(); | ||
} | ||
}) | ||
.expect('stdout', 'egg-ready') | ||
.end(done); | ||
``` | ||
#### coffee.debug(level) | ||
@@ -286,0 +301,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29868
549
329