Skip to content

Instantly share code, notes, and snippets.

@andrew8088
Created July 29, 2015 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrew8088/7a4a6e1dab8d2c903e4f to your computer and use it in GitHub Desktop.
Save andrew8088/7a4a6e1dab8d2c903e4f to your computer and use it in GitHub Desktop.
How to test a terminal command.
var test = require('tape');
var execSync = require('child_process').execSync;
test('ls', function (t) {
var output = execSync('ls').toString();
t.equal(output, 'node_modules\ntest.js\n');
t.end();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment