Feature: expose accurate test case location #3561
Labels
duplicate
been there, done that, got the t-shirt...
status: wontfix
typically a feature which won't be added, or a "bug" which is actually intended behavior
type: feature
enhancement proposal
Feature description
I would like to have access to precise location in which a test case has been defined (that is, filename, line, and column).
Possible use cases
setImmediate()
hooks) the stack trace contains absolutely no information as to which test exactly has failed and I have to resort to string lookup in the code (using the test's title)To clarify further with an example, I need to know where
it()
ortest()
have been called:PoC
I have successfully extracted the precise location of the test case's definition (even with applied source mapping⚠️ ) using this crude one-liner inserted at line 27 in this file:
mocha/lib/test.js
Lines 16 to 27 in c6f61e6
Logging
this.location
produces the following output:Implementation of this feature as I would imagine and need it to actually use it for my goals would entail
Would you accept pull requests implementing this feature? Are there requirements as to how this must be implemented? Am I allowed to add dependencies (ie. for parsing the stack traces into usable format)?
Thank you for considering! 🙏
The text was updated successfully, but these errors were encountered: