command.executableSubcommand.default.test.js
This file
Path
tests/command.executableSubcommand.default.test.js
25 lines · 872 bytes · JavaScript
Last changed by
Call default subcommand when there are unknown options on command line. (#1047)John Geebefore adoption5cac9d6
History of this fileTake it
Move to Jest as testing framework (#1035)John Geebefore adoptiond7f9cd4
lines 1–12why, one step back1const childProcess = require('child_process');2const path = require('path');34const bin = path.join(__dirname, './fixtures/pm');56test('when default subcommand and no command then call default', (done) => {7 childProcess.execFile(bin, [], { }, function(_error, stdout, stderr) {8 expect(stdout).toBe('default\n');9 done();10 });11});12Call default subcommand when there are unknown options on command line. (#1047)John Geebefore adoption5cac9d6
lines 13–22why, one step back13test('when default subcommand and unrecognised argument then call default with argument', (done) => {14 childProcess.execFile(bin, ['an-argument'], { }, function(_error, stdout, stderr) {15 expect(stdout).toBe("default\n[ 'an-argument' ]\n");16 done();17 });18});1920test('when default subcommand and unrecognised option then call default with option', (done) => {21 childProcess.execFile(bin, ['--an-option'], { }, function(_error, stdout, stderr) {22 expect(stdout).toBe("default\n[ '--an-option' ]\n");Move to Jest as testing framework (#1035)John Geebefore adoptiond7f9cd4
lines 23–25why, one step back23 done();24 });25});