command-line-test
v1.0.10
Published
command-line test tool for Node.js
Downloads
8,827
Readme
command-line-test
command-line test tool for Node.js
Installment
$ npm i command-line-test --save-dev
Usage
fork
, spawn
, exec
, execFile
supported.
const CliTest = require('command-line-test');
describe('test', function() {
it('constructor should be ok', function() {
CliTest.should.be.ok();
});
it('exec method should be ok with yeild', function *() {
const cliTest = new CliTest();
const res = yield cliTest.exec('cat package.json');
/**
* res return
* {
* error,
* stdout,
* stderr
* }
*/
const _pkg = JSON.parse(res.stdout);
pkg.name.should.be.equal(_pkg.name);
});
it('exec method should be ok with promise', function(done) {
const cliTest1 = new CliTest();
cliTest1.exec('cat package.json').then(res => {
const _pkg = JSON.parse(res.stdout);
pkg.name.should.be.equal(_pkg.name);
done();
});
});
it('exec method should be ok with callback', function(done) {
const cliTest1 = new CliTest();
cliTest1.exec('cat package.json', function(err, res) {
const _pkg = JSON.parse(res.stdout);
pkg.name.should.be.equal(_pkg.name);
done();
});
});
});
Sample
- macacajs/macaca-cli
- macacajs/app-inspector
- macacajs/detect-port
- reliablejs/reliable-master
- reliablejs/reliable-macaca-slave
License
The MIT License (MIT)