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

Failed test's error points to Chai #81

Closed
Reinmar opened this issue Nov 7, 2016 · 4 comments
Closed

Failed test's error points to Chai #81

Reinmar opened this issue Nov 7, 2016 · 4 comments

Comments

@Reinmar
Copy link

Reinmar commented Nov 7, 2016

See e.g. https://travis-ci.org/ckeditor/ckeditor5-engine/builds/173847164#L7972:

Error: Uncaught AssertionError: expected 1 to equal 2 (/home/travis/build/ckeditor/ckeditor5-engine/node_modules/chai/chai.js:206)

This is pretty useless if a test have more assertions. In the screenshot I can see that with some other assertion lib it works fine, so perhaps it's a problem with Chai. But what could help (and in fact, be pretty useful in general) was if a longer stack trace was logged in case of a failed assert.

@4kochi
Copy link
Collaborator

4kochi commented Nov 7, 2016

There is no limitation in the length of the stack trace. The reporter just displays the value coming from karma. So I guess this must be a problem specific to chai. I have tested it locally with the test included in this repository and they work fine.

screen

@Reinmar
Copy link
Author

Reinmar commented Nov 7, 2016

Hmm... We'll have to dig into this. I've got some theories and I'm curious now which one of them it is – Webpack, source maps, different assertion function used. I'll let you know if we find something :).

Thanks! :)

@Reinmar Reinmar closed this as completed Nov 7, 2016
@rosston
Copy link

rosston commented Nov 7, 2016

I've had similar frustrations with stack traces using the same tech stack (except browserify instead of webpack). I don't remember the particulars of it now, but I traced it back to karma (or maybe karma-mocha?) itself messing with the stack traces.

@Reinmar
Copy link
Author

Reinmar commented Nov 10, 2016

I debugged this. It turns out that we had a broken test which caused an async error to be thrown so it was caught by mocha's native onerror listener. So it has the stack of length 2 and this is quite understandable now (or at least more acceptable, taken the sourcemaps) that we got this a bit useless error. I'm only unsure why it's 1!=2 assertion, but I won't have time to debug it further now, so I must live with this :D.

Thanks for the help! :)

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