Comparing version 5.3.0 to 5.4.0
5.4.0 / 2020-04-28 | ||
================== | ||
**features** | ||
* [[`62c2d11`](http://github.com/node-modules/coffee/commit/62c2d1104af9944ae1c05ca1b4280c3f21ff222e)] - feat: pass instance to event (#81) (TZ | 天猪 <<atian25@qq.com>>) | ||
5.3.0 / 2020-04-22 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -61,3 +61,3 @@ 'use strict'; | ||
this.stdout += buf; | ||
this.emit('stdout', buf.toString()); | ||
this.emit('stdout', buf.toString(), this); | ||
}); | ||
@@ -68,3 +68,3 @@ this.on('stderr_data', buf => { | ||
this.stderr += buf; | ||
this.emit('stderr', buf.toString()); | ||
this.emit('stderr', buf.toString(), this); | ||
}); | ||
@@ -297,5 +297,2 @@ this.on('error', err => { | ||
} | ||
} else { | ||
// end stdin anyway | ||
cmd.stdin.end(); | ||
} | ||
@@ -302,0 +299,0 @@ |
{ | ||
"name": "coffee", | ||
"version": "5.3.0", | ||
"version": "5.4.0", | ||
"description": "Test command line on Node.js.", | ||
@@ -46,3 +46,4 @@ "main": "index.js", | ||
"ci": { | ||
"version": "6, 8, 10, 12" | ||
"version": "6, 8, 10, 12", | ||
"type": "travis, github" | ||
}, | ||
@@ -49,0 +50,0 @@ "scripts": { |
@@ -246,4 +246,6 @@ # Coffee | ||
cli process should emit `prompt` message: | ||
**cli process should emit `prompt` message:** | ||
> Or use `coffee.on('stdout', callback)` instead, see docs below. | ||
```js | ||
@@ -289,7 +291,10 @@ const readline = require('readline'); | ||
use for kill long-run process: | ||
```js | ||
coffee.fork('path/to/cli') | ||
.on('stdout', function (buf) { | ||
if (buf.toString().includes('egg-ready')) { | ||
this.proc.kill(); | ||
.on('stdout', (buf, { proc }) => { | ||
if (buf.includes('egg-ready')) { | ||
proc.exitCode = 0; | ||
proc.kill(); | ||
} | ||
@@ -301,2 +306,16 @@ }) | ||
use for prompt: | ||
```js | ||
// do not call `waitForPrompt` / `write` / `writeKey` | ||
coffee.fork('path/to/cli') | ||
.on('stdout', (buf, { proc }) => { | ||
if (buf.includes('Your Name: ')) { | ||
proc.stdin.write('TZ\n'); | ||
} | ||
}) | ||
.expect('stdout', 'Your Name: TZ\n') | ||
.end(done); | ||
``` | ||
#### coffee.debug(level) | ||
@@ -303,0 +322,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
30473
348
546