dd-trace-js icon indicating copy to clipboard operation
dd-trace-js copied to clipboard

Test our integrations' tests with the tracer enabled

Open rishabh opened this issue 5 years ago • 3 comments

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.

rishabh avatar Jul 23 '19 23:07 rishabh

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.

rishabh avatar Jul 27 '19 14:07 rishabh

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?

rishabh avatar Aug 05 '19 04:08 rishabh

Codecov Report

Merging #636 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           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.

codecov-io avatar Aug 16 '19 16:08 codecov-io

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.

tlhunter avatar Dec 13 '22 17:12 tlhunter