-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Feature request: Get detailed metadata from expect matchers in reporters #4547
Comments
I'm trying to figure out what the implications are for returning the file name here, and what the downsides are, but I cannot think clearly right now. I definitely think we should find a way to support this. @aaronabramov and @thymikee do you guys have any thoughts about this? |
Hm, this is another key in the object, so as long as we keep all properties initialized (at least in core matchers), we should still have this code monomorphic and perf shouldn't degrade I think. |
I took a break and have some more clarity. My concern was mostly around what exposing a file name will mean: Does returning an absolute path cause issues with caching? Should it be relative to the rootDir? More importantly: will this enable people to store more metadata in different files, without appropriate hooks to clean them up when a snapshot/test is removed? I worry that this is opening a can of worms that allows people to do crazy things and that we may need to provide a fuller API to hook into Jest that gives access to the cleanup hook etc. |
Hmm, I'm bit confused. I meant just adding possibility pass any metadata from a (custom) matcher to the (custom) reporters. Why does it matter if it's filename or any other string/object? |
@cpojer jest-snapshot returns a few extra properties but I am not sure that custom reporters have access to these. I think the ability for any metadata to be returned by a matcher and for reporters to pick up these properties is what @epeli is asking for. From the looks of the code comment in jest-snapshot this may already be possible though? |
@anescobar1991 did you ever figure out whether it's possible? I tried to access the data passed to |
Related #7594 |
I am trying to add custom metadata inside a test to be read by a custom reporter (like test category, severity, etc), is this issue related to this in any way? What is the current status of this? It is still open but was assigned to the v26 milestone |
I'd like to generate HTML reports from jest-image-snapshot with the diff images.
But doing it from a customer Jest reporter does not seem to be possible because because custom matchers such as the
toMatchImageSnapshot
cannot pass extra metadata (path to the snapshot diff file) to the reporters.I'd like to be able to return the filename here and read it somehow in a
onTestResult()
method of a reporter.Ref americanexpress/jest-image-snapshot#13
The text was updated successfully, but these errors were encountered: