dd-trace-js
dd-trace-js copied to clipboard
Test our integrations' tests with the tracer enabled
What does this PR do?
This PR adds the framework code necessary to test integration's tests with our tracer enabled. In other words, if we're instrumenting a module, we'd like to leverage that module's own tests to ensure that we don't break that module's functionality if we enable the tracer.
Motivation
This is a great way to catch instability issues.
Additional Notes
I've added a few test configs already, but currently facing issues with Jest.
Jest is a bit weird because it actually replaces require
. Because of this, the require-in-the-middle
hook does not catch any of the modules we want to patch.
A very hack-y workaround that might work would be to write our own require
hook that wraps Jest's require
and then, to avoid changing the tracer code, write our own resolver to resolve require-in-the-middle
to resolve to our new require
-hook module.
Another way would be to make Jest think the module we want to patch is an internal module. Internal modules are require
'd normally, and so require-in-the-middle
would catch it. I'm not sure what the side-effects would be.
Maybe we should add a way to run integrations' tests without injecting the tracer so we can compare the results. Or maybe there's a good way to diff the results?
Codecov Report
Merging #636 into master will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #636 +/- ##
=======================================
Coverage 96.14% 96.14%
=======================================
Files 92 92
Lines 3167 3167
=======================================
Hits 3045 3045
Misses 122 122
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update cb33849...ad74bba. Read the comment docs.
I'm going to close this PR out as it's 3 years old and has a bunch of conflicts. @rochdev believes this work ultimately turned into the current upstream tests.