standard-things / esm

Tomorrow's ECMAScript modules today!
Other
5.26k stars 146 forks source link

3.2.25 does not work with nyc #852

Open screendriver opened 4 years ago

screendriver commented 4 years ago

When I use esm together with nyc, mocha and ts-node (the project is written in TypeScript) all of my tests fail because it can't find my exported functions anymore: TypeError: <my-function> is not a function. When I run my tests without nyc it works fine. So the problem only occurs when I use nyc. The reason why I create this issue here and not at the nyc repository is that when I downgrade esm to 3.2.20 it works again. The issue only occurs when I use 3.2.25

I setup a small demo repository where you can reproduce the issue:

  1. clone and yarn install the repository
  2. yarn test:coverage gives you the error TypeError: calc is not a function
  3. downgrade esm to 3.2.20 and run it again ➡️ it works without any errors

Is this maybe somehow related to https://github.com/standard-things/esm/issues/782 that's already closed?

mroderick commented 4 years ago

With a little effort, you can find out exactly which commit was the first bad one (from the perspective of your application).

This information will greatly help maintainers understand the issue you're experiencing and will increase the odds of it getting resolved in a timely manner.

  1. Check out a copy of esm somewhere
  2. Use npm link in esm folder
  3. In your project folder, run npm link esm
  4. In esm folder you can now use git bisect to determine exactly which commit was the first bad one

See

Good luck!

AndyOGo commented 4 years ago

nyc -r esm tape test doesn't collect coverage for me. If I use babel-regsiter it collects coverage correctly 😕 nyc -r babel-regsiter tape test works.

Related PR: https://github.com/AndyOGo/stylelint-declaration-strict-value/pull/64

Alright downgrading esm to 3.2.20 works on my local machine, but not in Travis CI...