deltachat-core-rust icon indicating copy to clipboard operation
deltachat-core-rust copied to clipboard

node: upgrade mocha from 8 to 10

Open link2xt opened this issue 1 year ago • 0 comments

Even upgrading to Mocha 9 with npm install mocha@9 does not just work. Changelog says that at version 9.0 "Mocha is going ESM-first!".

npm run test fails with an error:

$ npm run test

> [email protected] test
> npm run test:lint && npm run test:mocha


> [email protected] test:lint
> npm run lint


> [email protected] lint
> prettier --check "node/lib/**/*.{ts,tsx}"

Checking formatting...
All matched files use Prettier code style!

> [email protected] test:mocha
> mocha -r esm node/test/test.js --growl --reporter=spec --bail --exit

(node:1986375) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)

/home/user/src/deltachat/deltachat-core-rust/node/test/test.js:2
import DeltaChat from '../dist'
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at new Script (node:vm:94:7)
    at wrapSafe (node:internal/modules/cjs/loader:1157:20)
    at Module._compile (node:internal/modules/cjs/loader:1220:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

link2xt avatar Nov 06 '23 22:11 link2xt