TheSwanFactory / hclang

Homoiconic C - a universal data format for computation
https://theswanfactory.wordpress.com/2016/12/20/homoiconic-c-a-universal-language-for-code-and-data/
MIT License
4 stars 0 forks source link

npm watch #181

Closed drernie closed 11 months ago

drernie commented 11 months ago

Get npm watch working

drernie commented 11 months ago

Replaces save-commands.json

{
    "commands": [
        "src/**/*.ts : npm test",
        "test/**/*.ts : npm test"
    ]
}
drernie commented 11 months ago

package.json used to have:

  "watch": {
    "test": "{src,test}/*.js"
  }
drernie commented 11 months ago

IMPORTANT https://www.alanwsmith.com/pages/js-mocha-watch-for-changes--29ag2did/

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

mocha --watch --parallel

Adding --parallel is based off this comment to a GitHub issue about --watch not working by itself with ES Modules. If you try to run mocha --watch without --parallel it produces errors like:

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.