test to demonstrate coffee issue with --args

If you try to run nodemon with a coffee file script and pass an
argument to your application, it is instead adding a --nodejs when there
are no node flags to pass along. This causes the command to fail because
the script name is now passed as a flag to node.

Repro:

  nodemon script.coffee --my-argument

Expected:

  coffee script.coffee --my-argument

Actual:

  coffee --nodejs script.coffee --my-argument

Related to #530
This commit is contained in:
Doug Patti
2015-04-20 17:34:42 -04:00
parent 1f01aaaa7a
commit 55320b7d85

View File

@@ -282,6 +282,19 @@ describe('nodemon with CoffeeScript', function () {
assert(settings.execOptions.execArgs.indexOf('--nodejs') === -1, 'is not using --nodejs');
});
it('should not add --nodejs with app arguments', function () {
var settings = parse(asCLI('test/fixtures/app.coffee --my-app-arg'));
assert(settings.execOptions.exec.indexOf('coffee') === 0, 'executable is CoffeeScript');
assert(settings.execOptions.execArgs.indexOf('--nodejs') === -1, 'is not using --nodejs');
});
it('groups exec argument into a single --nodejs argument', function () {
var settings = parse(asCLI('--harmony --debug test/fixtures/app.coffee'));
assert(settings.execOptions.exec.indexOf('coffee') === 0, 'executable is CoffeeScript');
assert(settings.execOptions.execArgs[0] === '--nodejs', 'is using --nodejs');
assert(settings.execOptions.execArgs[1] === '--harmony --debug', 'is grouping exec arguments');
});
it('should add --nodejs when used with --debug', function () {
var settings = parse(asCLI('--debug test/fixtures/app.coffee'));
var cmd = commandToString(command(settings));