Skip to content
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

testdouble incompatible with coverage tools? #374

Closed
3 tasks done
joebowbeer opened this issue May 29, 2018 · 1 comment
Closed
3 tasks done

testdouble incompatible with coverage tools? #374

joebowbeer opened this issue May 29, 2018 · 1 comment

Comments

@joebowbeer
Copy link

Description

Observing problems using testdouble and nyc in the same project.

Issue

I have a small es6 Javascript project that uses testdouble with a mocha test runner. mocha works fine, but nyc mocha is flakey.

When coverage fails, I see transformation error messages in the console output and the coverage report is empty. If I comment-out the td code in my tests and re-run test coverage, then coverage works and will continue to work until I change the code-under-test, at which point the instrumentation fails again.

I couldn't find any projects where testdouble was used with code coverage, so I converted my project to use rewiremock and coverage worked reliably.

Environment

  • node -v output: v8.9.4
  • npm -v output: 6.1.0
  • npm ls testdouble version: 3.8.1

Example Repo

This project might be useful in repro'ing the issue:

https://github.com/jamestalmage/__demo-nyc-with-proxyquire

@searls
Copy link
Member

searls commented Jun 4, 2018

Could you provide a reproduction that uses testdouble? I've definitely seen tdjs used in projects with coverage before, so I'm dubious that this is a testdouble.js issue.

For example, the library itself uses nyc for coverage and it makes ample use of td.replace in the unit test suite, but still shows accurate coverage readings AFAICT:

=============================== Coverage summary ===============================
Statements   : 97.86% ( 959/980 )
Branches     : 94.12% ( 336/357 )
Functions    : 94.31% ( 232/246 )
Lines        : 98.07% ( 913/931 )
================================================================================

Closing until we can get a reproduction case to test with

@searls searls closed this as completed Jun 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants