Comments (2)
I have done some investigation into this, as I believed it to be an interesting feature, and have found a few issues that might make this tricky to implement.
First off, the example you provided above would not work (not even in mochawesome) as you are using Arrow Functions.
From mochawesome documentation:
Be sure to use ES5 functions and not ES6 arrow functions when using addContext to ensure this references the test object.
-https://github.com/adamgruber/mochawesome#example
Personally I believe it's important not to tie the usage of this plugin to a certain ES-version, especially since Jest is using Arrow Functions in their documentation.
However, the biggest issue is the fact that Jest have (as far as I can see) removed the usage of this
(please see jestjs/jest#3553) which means that there is no direct way of getting the test context. I have done several tests, and I cannot seem to get hold of the test data either within beforeEach
, afterEach
or it
/test
.
I was able to pass the data it by assigning the it
/test
to a variable which was then passed into the addContext
-method. Although that would mean that users would need to change the entire structure of their tests in order for this to work, and that is not something that I am aiming for with this plugin.
If anyone has any ideas, don't hesitate to drop a line.
from jest-html-reporter.
Closing this for now
from jest-html-reporter.
Related Issues (20)
- TypeError: Cannot read property 'replace' of undefined HOT 1
- Html report broken when test response is html HOT 2
- Wrong coverage reported in constants HOT 1
- Assertion messages are malformed HOT 2
- Error: Could not resolve a module for a custom reporter.
- Doesn't support jest 28. HOT 4
- ENHANCEMENT: add configuration option for passing arbitrary data HOT 1
- code coverage export HOT 3
- Jest 29 HOT 1
- Extra Text in HTML Report HOT 4
- Is there a way I can Display something other than file path here? HOT 2
- TypeScript 5 support?
- appending adds several bodies and adds custom script several times
- Added into report configuration additional flag "includeStackTrace": false HOT 2
- The default colored console output is unreadable
- Make test suites collapsible (and collapse them by default) HOT 1
- Sort + append? HOT 1
- babel dependencies HOT 2
- How can we capture Request Payload & Response Json and show them to jest-html-reporter for REST API Automation framework? HOT 1
- [FIX] ENAMETOOLONG: name too long, ... errors due to too long name of generated temp directory HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jest-html-reporter.