8

I work at a company where @std/esm has not been approved. I have got my Mocha test working like this...

// suite.js
async function wire(){
    await import("./Sanity.spec.mjs"); // eslint-disable-line
    run();
}
wire();

//Sanity.spec.mjs
import chai from "chai"

describe("My Test", ()=>{
    it("Should do what I want", ()=>chai.assert.equal(1,1, "One is in fact 1")); // eslint-disable-line no-self-compare
});

But when I run like nyc mocha --delay --exit ./test/suite.js I see the mocha tests run but the code coverage results are empty.

  My Test
    √ Should do what I want

  When using base App
info: Healthcheck server is listening on 420
    √ App should not be null
    √ The port should be correct


  3 passing (24ms)

----------|----------|----------|----------|----------|-------------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files |        0 |        0 |        0 |        0 |                   |
----------|----------|----------|----------|----------|-------------------|

I left the other tests out but they do import libraries. The question is how do I get this to work with NYC?

JGleason
  • 3,067
  • 6
  • 20
  • 54
  • Does this answer your question? [How do I get Istanbul to recognize code coverage when using ESM?](https://stackoverflow.com/questions/54716787/how-do-i-get-istanbul-to-recognize-code-coverage-when-using-esm) – lifeisfoo Mar 23 '21 at 10:33

0 Answers0