-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Exposing filename in JSON, doc, and json-stream reporters #4219
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add filename to JSON reporter, we should consider to add it to other reporters like JSONStream reporter.
@outsideris I have added filename exposure to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I note that this will break #4245, but that's my problem.
If there's a case in which test.file
is undefined
(I am unsure if this is possible), these reporters will print undefined
. Might be worth while to check for test.file
, and if it's falsy, output (no filename)
or something instead. Not a big deal, and this could be merged w/o it.
Given that I also can't think of a test that isn't located in a file, I'm good with merging as-is then 😄 . If anyone has strong opinions on the matter though I am open to that. |
* Exposing filename in JSON reporter * Added filename to json-stream reporter * updated tests and also fixed issue with json-stream reporter * added filenames to doc reporter
Description of the Change
This change makes the
json
,doc
, andjson-stream
reporters output the test filenames in addition to their other attributesAlternate Designs
No other designs were considered in the making of this pull request
Why should this be in core?
There currently is not a way to access filenames through reporters when running tests even though mocha has full access to it.
Benefits
People who want to see what file is associated with their test step will easily be able to see it in the
json
,doc
, andjson-stream
reporters. This is especially useful for people with large code/test base where it may be difficult to find the test.Possible Drawbacks
If we intend to encapsulate the test's filename, then this code change would be an issue
Applicable issues
This would be considered a minor release.