Socket
Socket
Sign inDemoInstall

command-line-test

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    command-line-test

command-line test tool for Node.js


Version published
Maintainers
1
Install size
10.5 kB
Created

Readme

Source

command-line-test

NPM version build status Test coverage node version npm download

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

License

The MIT License (MIT)

Keywords

FAQs

Last updated on 11 Aug 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc