You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, to create more powerful custom reporters in jest it would be extremely helpful to provide an easy possibility to pass information from a jest test to a custom reporter hook (e.g. onTestCaseResult). This will enable people to define metadata for tests such as Author, Ticket, Tags,...
Motivation
Firstly, it will allow the community to build more powerful customer jest reporters as this can be used as an additional source of input for the reporter and are no longer limited by the currently available fields.
Secondly, we have a microservice platform architecture where each "product feature" is wrapped in its own app, which is located in its own repository and is then offered to the customer as part of a platform. To ensure the quality of the individual apps and release the apps with confidence, we have a single source of truth for test coverage and part of this is that we report metadata such as test author, ticket (to map it to a product feature) and tags for each test. However, this is currently only possible via a ugly workaround and results in test name adaptations which is not a good practices and feels like a weird workaround for something relatively "simple".
Workaround I am talking about where the metadata is passed base64 encoded as part of the testname.
I saw that there is a package called jest-metadata which provides something similar however this requires defining a custom jest-environment which is sadly no option for us as we already have a custom jest-environment which is also shipped to our customers and therefore we can't combine this as our customers should not use this metadata functionality.
Example
Here is an example on how i could imagine it will look like in the code:
describe('test',()=>{it.reporter({author: 'john.doe',ticket: 'ABC-123456',tags: ['foo','bar'],});it(ctc`simple test 2`,async()=>{expect(false).toBeTruthy();});it.reporter({author: 'john.test',ticket: 'ABC-123456',tags: ['foo','bar'],});it(ctc`simple test1`,()=>{expect(false).toBeTruthy();});});
Calling it.reporter will make the passed information available as part of the test object of the onTestCaseResult(test: Test, testCaseResult: TestCaseResult) hook.
Pitch
It will allow more out-of-the-box variability for custom jest reporters, which would be quite a good thing.
The text was updated successfully, but these errors were encountered:
🚀 Feature Proposal
Hey, to create more powerful custom reporters in jest it would be extremely helpful to provide an easy possibility to pass information from a jest test to a custom reporter hook (e.g. onTestCaseResult). This will enable people to define metadata for tests such as Author, Ticket, Tags,...
Motivation
Firstly, it will allow the community to build more powerful customer jest reporters as this can be used as an additional source of input for the reporter and are no longer limited by the currently available fields.
Secondly, we have a microservice platform architecture where each "product feature" is wrapped in its own app, which is located in its own repository and is then offered to the customer as part of a platform. To ensure the quality of the individual apps and release the apps with confidence, we have a single source of truth for test coverage and part of this is that we report metadata such as test author, ticket (to map it to a product feature) and tags for each test. However, this is currently only possible via a ugly workaround and results in test name adaptations which is not a good practices and feels like a weird workaround for something relatively "simple".
Workaround I am talking about where the metadata is passed base64 encoded as part of the testname.
I saw that there is a package called jest-metadata which provides something similar however this requires defining a custom jest-environment which is sadly no option for us as we already have a custom jest-environment which is also shipped to our customers and therefore we can't combine this as our customers should not use this metadata functionality.
Example
Here is an example on how i could imagine it will look like in the code:
Calling
it.reporter
will make the passed information available as part of the test object of theonTestCaseResult(test: Test, testCaseResult: TestCaseResult)
hook.Pitch
It will allow more out-of-the-box variability for custom jest reporters, which would be quite a good thing.
The text was updated successfully, but these errors were encountered: