Skip to content

Instantly share code, notes, and snippets.

@jordaaash
Created October 25, 2021 01:18
Show Gist options
  • Save jordaaash/2a0c3c360aa700cc9528e89620e82c3d to your computer and use it in GitHub Desktop.
Save jordaaash/2a0c3c360aa700cc9528e89620e82c3d to your computer and use it in GitHub Desktop.
Mocha + TypeScript + ESM
{
"extension": ["ts"],
"node-option": ["experimental-specifier-resolution=node", "loader=ts-node/esm"],
"spec": ["test/**/*.test.ts"]
}
{
"type": "module",
"sideEffects": false,
"scripts": {
"test": "mocha"
},
"devDependencies": {
"@types/chai-as-promised": "^7.1.4",
"@types/mocha": "^9.0.0",
"@types/node": "^16.9.1",
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
"mocha": "^9.1.3",
"ts-node": "^10.3.0",
"tslib": "^2.3.0",
"typescript": "^4.4.3"
}
}
{
"compilerOptions": {
"outDir": "lib",
"noEmit": false,
"declaration": true,
"sourceMap": true,
"noEmitOnError": true,
"stripInternal": true,
"target": "es6",
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"isolatedModules": true,
"typeRoots": ["node_modules/@types", "types"]
},
"include": ["src", "types", "test"],
"exclude": ["node_modules"]
}
@thebearingedge
Copy link

Watch mode is broken with this configuration but adding --parallel seems to fix the problem.

mochajs/mocha#4374 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment