Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Unit tests are missing when script type="module" takes >= 3ms before describe #243

Open
loynoir opened this issue Oct 24, 2021 · 1 comment

Comments

@loynoir
Copy link

loynoir commented Oct 24, 2021

Repo

https://github.com/loynoir/reproduce-karmaMocha-237.mjs

Scenario

  • import a slow ESM module
  • and it takes ~1 second

Reproduce

$ npm install
$ npm test

Expected

Three tests

  CJS
    ✔ bar
  fastESM
    ✔ bar
  slowESM
    ✔ bar

SUMMARY:
✔ 3 tests completed

Actual

Missing unit test slowESM, but exit with code 0.

  CJS
    ✔ bar
  fastESM
    ✔ bar

SUMMARY:
✔ 2 tests completed
@loynoir
Copy link
Author

loynoir commented Oct 24, 2021

If top level await use <3ms, unit test seems OK. 🤔

https://github.com/loynoir/reproduce-karmaMocha-237.mjs/blob/master/test/fastESM.spec.mjs#L5

@loynoir loynoir changed the title Unit tests are missing if XXX.spec.mjs import ESM use ~1 second Unit tests are missing when script type="module" takes >= 3ms before describe Oct 25, 2021
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

1 participant