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

Show test suite file names in failure output #10659

Closed
kumar303 opened this issue Aug 11, 2017 · 6 comments · Fixed by mozilla/addons-frontend#5602
Closed

Show test suite file names in failure output #10659

kumar303 opened this issue Aug 11, 2017 · 6 comments · Fixed by mozilla/addons-frontend#5602

Comments

@kumar303
Copy link
Contributor

Describe the problem and steps to reproduce it:

Trigger a test failure that happens on the event loop. In other words, one that won't produce a stack trace pointing back to the test file.

What happened?

You have no easy way to figure out which test file produced the error. Example:

screenshot 2017-08-11 10 26 14

What did you expect to happen?

You should be able to easily figure out which test file produced the error.

Anything else we should know?

We can totally do this now that Jest runs from NodeJS! We can start every test with describe(__filename, ...) which will produce errors like this:

screenshot 2017-08-11 10 23 57

@kumar303
Copy link
Contributor Author

Hah, ignore me. I have so much console output (thinking of jestjs/jest#4156) that I forgot how Jest prints the failing test name at the top:

screenshot 2017-08-11 11 00 48

@tofumatt
Copy link
Contributor

That's what I thought happened but figured maybe with a catastrophic failure it wouldn't print.

Nothing to see here then! 😅

@kumar303
Copy link
Contributor Author

I thought about this more and I still think the change would be helpful. What do you think? Here are the benefits I see:

  • The bottom line of a failing test will always show the filename. Otherwise, you'd have to scroll up beyond all the console logging to find it.
  • We won't have to think of what to type in the initial describe() function ever again :) It can just always be __filename

@kumar303 kumar303 reopened this Aug 11, 2017
@tofumatt
Copy link
Contributor

tofumatt commented Aug 11, 2017

I'm okay with all root-level describe()s amounting to describe(__filename) but I'd rather there just be a helper–that sort of boilerplate is annoying...

Dunno if that's possible though. I'm cool with this idea regardless though, I can never think of what to name these things!

@kumar303
Copy link
Contributor Author

I don't think a helper would be helpful because you'd have to pass it __filename since that is different depending on the file. In other words, a helper would have to look like:

describe(showFile(__filename), ...);

which is pointless.

@tofumatt
Copy link
Contributor

tofumatt commented Aug 11, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

6 participants