test/fixtures/helper.js
/**
 * Asserts that the given command was called with the given arguments.
 */
Asserts that the given command was called with the given arguments.
Asserts that the given command was called with the given arguments .
function assert (cmd, calls) {
  calls = Array.prototype.slice.call(arguments, 1);
  sinon.assert.callCount(console.log, calls.length);
  sinon.assert.callCount(childProcess.fork, calls.length);
  calls.forEach((args, index) => {
    let log = console.log.getCall(index);
    expect(log.args).to.have.lengthOf(2);
    expect(log.args[0]).to.equal(cmd);
    expect(log.args[1]).to.equal(args.join(" "));
    let exec = childProcess.fork.getCall(index);
    expect(exec.args).to.have.lengthOf(2);
    expect(exec.args[0]).to.equal(require.resolve(cmd + "/bin/cmd"));
    expect(exec.args[1]).to.deep.equal(args);
  });
}
function assert ( cmd , calls ) { calls = Array . prototype . slice . call ( arguments , 1 ) ; sinon . assert . callCount ( console . log , calls . length ) ; sinon . assert . callCount ( childProcess . fork , calls . length ) ; calls . forEach ( ( args , index ) => { let log = console . log . getCall ( index ) ; expect ( log . args ) . to . have . lengthOf ( 2 ) ; expect ( log . args [ 0 ] ) . to . equal ( cmd ) ; expect ( log . args [ 1 ] ) . to . equal ( args . join ( " " ) ) ; let exec = childProcess . fork . getCall ( index ) ; expect ( exec . args ) . to . have . lengthOf ( 2 ) ; expect ( exec . args [ 0 ] ) . to . equal ( require . resolve ( cmd + "/bin/cmd" ) ) ; expect ( exec . args [ 1 ] ) . to . deep . equal ( args ) ; } ) ; }
Asserts that the given command was called with the given arguments.
Asserts that the given command was called with the given arguments .
// Make sure each stub was called the correct number of times