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

Stop on first failed assertion #220

Closed
jankuca opened this issue Nov 16, 2015 · 1 comment
Closed

Stop on first failed assertion #220

jankuca opened this issue Nov 16, 2015 · 1 comment

Comments

@jankuca
Copy link
Contributor

jankuca commented Nov 16, 2015

I noticed that test cases are not stopped when an assertion fails. To be exact, they are stopped asynchronously. Here is an example:

test(t => {
  let arr = [ { name: 'abc' } ];
  t.is(arr.length, 2);
  t.is(arr[1].name, 'xyz');
  t.end();
});

The error I'd expect to see is "1 !== 2" while the actual error I get is "cannot read property 'name' of undefined" because execution is not stopped on the failed assertion (on the line above).

Is there a reason why Test#exit() is called asynchronously (by Test#_assert()) rather than synchronously (which is the case for errors thrown outside assertions)?

@jamestalmage
Copy link
Contributor

Duplicate of #121

Fix PR: #259

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants