got icon indicating copy to clipboard operation
got copied to clipboard

Enable coverage again

Open sindresorhus opened this issue 4 years ago • 7 comments
trafficstars

Had to be disabled for ESM: https://github.com/sindresorhus/got/pull/1687/commits/1eee7c24a33251ae52bbcf841e94760cecd3e6f3

Blocked by https://github.com/istanbuljs/nyc/issues/1353 (I tried using the mentioned @istanbuljs/esm-loader-hook, but it didn't work)

sindresorhus avatar Apr 15 '21 17:04 sindresorhus

c8 is a better and faster alternative to nyc and it works with esm https://www.npmjs.com/package/c8

sayem314 avatar Apr 27 '21 12:04 sayem314

@sayem314 it's not better because it's not reliable. It gives false line numbers.

szmarczak avatar Apr 27 '21 17:04 szmarczak

@szmarczak I see. For me, it works fine hence recommended.

sayem314 avatar Apr 27 '21 17:04 sayem314

@sayem314 Thanks for the suggestion :)

szmarczak avatar Apr 27 '21 17:04 szmarczak

@sindresorhus it looks like got/package.json tells ava to use --loader=ts-node/esm. Unfortunately node.js does not support chaining multiple --loader options.

coreyfarrell avatar May 05 '21 19:05 coreyfarrell

Relevant: nodejs/modules#513 ā€œUsing multiple loadersā€.

andersk avatar Aug 27 '21 22:08 andersk

I think this could be done with a single loader, as long as it’s Babel instead of ts-node: use --loader babel-register-esm with a babel.config.json like this.

{
  "presets": ["@babel/typescript"],
  "env": {
    "test": {
      "plugins": ["babel-plugin-istanbul"]
    }
  }
}

andersk avatar Aug 28 '21 00:08 andersk