-
Notifications
You must be signed in to change notification settings - Fork 303
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
How to trace jest with custom environment #4164
Comments
hey @lughino ! Thanks for the report. My first thought was that you could extend directly from Sadly I don't think there's any workaround for you, as we only monkey patch dd-trace-js/packages/datadog-instrumentations/src/jest.js Lines 296 to 304 in a60bd24
This said, I think adding support for |
I'm closing this due to lack of activity. Feel free to reopen if you want to keep discussing |
Hi there,
I need to use a custom environment as I need a newer version of jsdom, so I imported the new
@jest/environment-jsdom-abstract
package and created a custom environment that extends from that class:Unfortunately, I did not get that working. I always get this error:
To initiate the
dd-trace
I tried to use thedd-trace/ci/init
through NODE_OPTIONS, or simply including it in this test env file likerequire('dd-trace').init();
.None of my attempts made it work.
The jest settings are:
If I switch to
testEnvironment: 'jsdom'
everything works properly.I also tried to copy the exact content of the old
jest-environment-jsdom
package inside this custom file but I always get the same error.It seems like there is some sort of logic around those test environments that prevents me from using tracing in a custom environment.
Any help would be very appreciated
The text was updated successfully, but these errors were encountered: