diff --git a/test/wiredep_cli.js b/test/wiredep_cli.js index 08fedef..05ab9c1 100644 --- a/test/wiredep_cli.js +++ b/test/wiredep_cli.js @@ -46,34 +46,34 @@ describe('wiredep-cli', function () { }); describe('argument checks', function () { - function runLog (args, errMsg) { - var stub = sinon.stub(console, 'log'); + function runLog (args, errMsg, method) { + var stub = sinon.stub(console, method); reset(); process.argv = ['', ''].concat(args); require('../wiredep-cli'); - assert(stub.calledOnce, 'Console.log was not called'); + assert(stub.calledOnce, 'Console.' + method + ' was not called'); assert(stub.calledWithMatch(errMsg), 'Message did not match'); stub.restore(); } it('should return the version', function () { var version = require('../package.json').version; - runLog(['-v'], version); - runLog(['--version'], version); + runLog(['-v'], version, 'info'); + runLog(['--version'], version, 'info'); }); it('should display help when called with no args or help ones', function () { [[], ['-h'], ['--help']].forEach(function (arg) { - runLog(arg, /^Wire Bower dependencies to your source code/); + runLog(arg, /^Wire Bower dependencies to your source code/, 'info'); }); }); - it('should log when source is not specified', function () { + it('should error when source is not specified', function () { var msg = /Source file not specified/; - runLog(['-b', 'bower.json'], msg); - runLog(['--bowerJson', 'bower.json'], msg); + runLog(['-b', 'bower.json'], msg, 'error'); + runLog(['--bowerJson', 'bower.json'], msg, 'error'); }); }); }); diff --git a/wiredep-cli.js b/wiredep-cli.js index 85376cb..c70c421 100755 --- a/wiredep-cli.js +++ b/wiredep-cli.js @@ -45,12 +45,12 @@ var helpOptionText = Object.keys(options).map(function (key) { if (argv.version) { - console.log(pkg.version); + console.info(pkg.version); return; } if (argv.help || !Object.keys(argv).length) { - console.log( + console.info( pkg.description + EOL + EOL + 'Usage: ' + chalk.cyan('$') + chalk.bold(' wiredep ') + @@ -62,7 +62,7 @@ if (argv.help || !Object.keys(argv).length) { } if (!argv.src) { - console.log( + console.error( chalk.bold.red('> Source file not specified.') + EOL + 'Please pass a `--src path/to/source.html` to `wiredep`.' ); @@ -80,7 +80,7 @@ try { fs.statSync(path.normalize('./bower.json')); } } catch (e) { - console.log( + console.error( chalk.bold.red('> bower.json not found.') + EOL + 'Please run `wiredep` from the directory where your `bower.json` file' + ' is located.' + EOL + @@ -93,5 +93,5 @@ try { var results = wiredep(argv); if (argv.verbose) { - console.log(results); + console.info(results); }