Skip to content
This repository was archived by the owner on Dec 8, 2024. It is now read-only.

Using with amdefine. #196

Open
tbranyen opened this issue Apr 28, 2014 · 3 comments
Open

Using with amdefine. #196

tbranyen opened this issue Apr 28, 2014 · 3 comments

Comments

@tbranyen
Copy link

Is it possible to use Istanbul with Mocha and amdefine?

When I run the tests I see something like this:

$ npm run mocha

> [email protected] mocha /home/tim/git/my-module
> istanbul cover _mocha -- -r test/runner test/tests/**


  ․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․
  ․․․․․․․․․

  71 passing (38ms)

No coverage information was collected, exit without writing coverage information

The script command in package.json is:

  "scripts": {
    "mocha": "istanbul cover _mocha -- -r test/runner test/tests/**"
  }
@Raynos
Copy link

Raynos commented Apr 28, 2014

depends on what your code looks like.

Istanbul does instrumentation by hooking into require via require.extensions

It also hooks into various vm methods.

if amdefine hooks into module directly or spawns child processes or overwrites require.extensions['.js'] then it wont work

@tbranyen
Copy link
Author

Amdefine works by hooking into require.extensions.

It should be possible then to either modify amdefine or istanbul to handle the case where an extension override is already set.

@Raynos
Copy link

Raynos commented Apr 28, 2014

it will need to be a change to amdefine as it overwrites the istanbul require extensions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants