Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Watch A Directory And Run Mocha JS With ES Modules When Files Change

This is how I'm running Mochajs in watch mode with ES Modules :

bash
mocha --watch --parallel

Adding [TODO: Code shorthand span ] is based off this comment to a GitHub issue about [TODO: Code shorthand span ] not working by itself with ES Modules.

If you try to run [TODO: Code shorthand span ] without [TODO: Code shorthand span ] it produces errors like :

bash
Error [ERR_REQUIRE_ESM]: require() of ES Module 
/file/path/file.mjs not supported.
Instead change the require of /file/path/file.mjs 
to a dynamic import() which is available in all 
CommonJS modules.

(I think I've done the dynamic import stuff before in other projects, but haven't tried it with Mocha yet)