Closed jason0x43 closed 4 years ago
4.8.0 exhibits the broken behavior.
4.4.3 was the last version that doesn't exhibit the double instrumenting behavior.
The istanbul dependencies were updated in Intern 4.5.0. In particular, istanbul-lib-coverage
was updated from 1.1.0 to 2.0.1. Possibly that's the source of the issue.
The problem is with istanbul-lib-hook
. Downgrading to 1.2.2 works. Version > 1.2.2 will run both the "runInThisContext" and "require" hooks when importing files.
The root problem is that, prior to the use of istanbul-lib-hook@2 in Intern 4.5, the runInThisContext
hook was never executed (at least with Node 10+) because istanbul wasn't using the correct API for runInThisContext
(https://github.com/istanbuljs/issues#89). The issue doesn't occur for Intern's self tests.
Resolved in 1160f8e. Intern 5-pre did not have this issue.
In at least some scenarios, coverage in Intern 4.5+ is broken.
Example:
With Intern 4.8.5 on Node 10.15.3:
This same example with Intern 4.3.6:
Note that the app file is instrumented twice in 4.8.5. That's not good.