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

NYC swallows error code if test runs out of memory #823

Closed
stringbeans opened this issue Apr 27, 2018 · 3 comments
Closed

NYC swallows error code if test runs out of memory #823

stringbeans opened this issue Apr 27, 2018 · 3 comments

Comments

@stringbeans
Copy link

Expected Behavior

nyc will forward the exit code resulting from tests that run out of memory.

Observed Behavior

If nyc is used on a test which fails due to JS running out of memory, nyc seems to swallow the error and report exit code = 0

Forensic Information

To reproduce:

  1. create a mocha test with the following code:
describe('test', function() {
  before(function() {
    const myArr = [];
    while (true) myArr.push('makeThisLongerToDieQuicker');
  });

  it('will never get here', () => {

  });
});
  1. run node_modules/.bin/mocha test.js
  2. run echo $? (notice that the exit code is 134)
  3. run node_modules/.bin/nyc node_modules/.bin/mocha test.js
  4. run echo $? (notice that the exit code is 0)

I'm using [email protected] and [email protected] with node v8.9.3

Operating System: MacOSX 10.12.6

@mlrawlings
Copy link

Duplicate of #798

Interestingly, if you look at the issue I opened, it is only the combination of nyc mocha that causes the issue, so I'm not sure which side the issue is on. mocha only preserves the error code as does nyc node.

@stringbeans
Copy link
Author

@mlrawlings ahh apologies on the dupe! i wasnt able to find it when i was searching. thats an interesting thing about it being specific to mocha though.

seems like if running only mocha with the failing test produces the correct error code, i wouldnt expect the issue to be on mocha's side... maybe? 😕

@JaKXz JaKXz added the duplicate label May 1, 2018
@JaKXz
Copy link
Member

JaKXz commented May 1, 2018

Mind if we isolate the discussion to #798? Thanks :)

@JaKXz JaKXz closed this as completed May 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants