Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix passing of args intended for node/iojs. #1567

Merged
merged 1 commit into from
Mar 9, 2015

Conversation

tawdle
Copy link
Contributor

@tawdle tawdle commented Feb 25, 2015

The recent commit 1430c2b inadvertently broke the ability pass arguments to node/iojs before running mocha -- note that arguments intended for the executable are prepended to args; the previous commit assumes that args[0] will be the executable, but that is only correct if no args intended for the executable have been unshifted onto args.

So, if you try, for instance:

mocha --harmony ...

... you'll get an ENOENT error as spawn tries to execute a file named --harmony.

See #1548 for the origin of this issue.

@danielstjules
Copy link
Contributor

@travisjeffery This seems to work :)

iojs

$ node --version
v1.4.3

$ cat example.js
it('test', function(done) {
  setTimeout(() => done(), 0);
});

// Before PR
$ ./bin/mocha --harmony_arrow_functions example.js
events.js:141
      throw er; // Unhandled 'error' event
            ^
Error: spawn --harmony_arrow_functions ENOENT
    at exports._errnoException (util.js:734:11)
    at Process.ChildProcess._handle.onexit (child_process.js:1022:32)
    at child_process.js:1114:20
    at process._tickCallback (node.js:350:11)
    at Function.Module.runMain (module.js:487:11)
    at startup (node.js:112:16)
    at node.js:863:3

// After PR
$ ./bin/mocha --harmony_arrow_functions example.js

  

  1 passing (8ms)

node

$ node --version
v0.12.0
danielstjules:~/git/mocha (master =)
$ cat example.js
it('test', function(done) {
  var fn = function*() {};
  done();
});

// Before PR
$ ./bin/mocha --harmony-generators example.js
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: spawn --harmony-generators ENOENT
    at exports._errnoException (util.js:746:11)
    at Process.ChildProcess._handle.onexit (child_process.js:1046:32)
    at child_process.js:1137:20
    at process._tickCallback (node.js:355:11)
    at Function.Module.runMain (module.js:503:11)
    at startup (node.js:129:16)
    at node.js:814:3

// After PR
$ ./bin/mocha --harmony-generators example.js

  

  1 passing (5ms)

@fengmk2
Copy link
Contributor

fengmk2 commented Mar 7, 2015

+1

1430c2b break all tests with --harmony flags enable...

@fengmk2
Copy link
Contributor

fengmk2 commented Mar 7, 2015

ping @travisjeffery

@dasilvacontin dasilvacontin added the type: bug a defect, confirmed by a maintainer label Mar 7, 2015
@danielstjules
Copy link
Contributor

+1 from me :)

@danielstjules
Copy link
Contributor

This is also related to #1583

@danielstjules
Copy link
Contributor

@tawdle Any chance you could add a regression test for this? If not, I can fork this PR and add one.

@am11 am11 mentioned this pull request Mar 8, 2015
@davemackintosh
Copy link

+1 from me, rolling back.

@danielstjules
Copy link
Contributor

@travisjeffery @boneskull Think we could merge this in and do a quick patch release? I'll see if I can write an acceptance/regression test for this afterward.

travisjeffery pushed a commit that referenced this pull request Mar 9, 2015
Fix passing of args intended for node/iojs.
@travisjeffery travisjeffery merged commit dc2fed7 into mochajs:master Mar 9, 2015
@travisjeffery
Copy link
Contributor

Awesome, thanks. Published 2.2.1 with this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug a defect, confirmed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants