From faed894c496569b178b8c19b87988ab631249311 Mon Sep 17 00:00:00 2001 From: Ben Sorohan Date: Mon, 4 Dec 2017 12:23:48 +0100 Subject: [PATCH] Add test for empty option on command Fixes #727 --- test/test.command.action.emptyOption.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/test.command.action.emptyOption.js diff --git a/test/test.command.action.emptyOption.js b/test/test.command.action.emptyOption.js new file mode 100644 index 000000000..33276754f --- /dev/null +++ b/test/test.command.action.emptyOption.js @@ -0,0 +1,20 @@ +/** + * Module dependencies. + */ + +var program = require('../') + , should = require('should'); + +var val = "some cheese" +program + .name('test') + .command('mycommand') + .option('-c, --cheese [type]', 'optionally specify the type of cheese') + .action(function(cmd) { + val = cmd.cheese; + }); + +program.parse(['node', 'test', 'mycommand', '--cheese', '']); + +val.should.equal(''); +