I'm currently troubleshooting unit testing using Visual Studio Code and mocha, but I encounter an error when mocha is launched.
TSError: ⨯ Unable to compile TypeScript: mfa/test/index.test.ts(4,20): error TS2307: Cannot find module 'assert' or its corresponding type declarations.
Here's my launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "mocha tests",
"type": "node",
"protocol": "inspector",
"request": "launch",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"stopOnEntry": false,
"args": [ "-r", "ts-node/register", "${workspaceRoot}/test/**/*.test.ts", "--no-timeouts"],
"sourceMaps": true,
"cwd": "${workspaceRoot}"
}
]
}
This is my tsconfig.json:
{
"compilerOptions": {
"experimentalDecorators": true,
"target": "ES2017",
"module": "commonJs",
"allowJs": false,
"sourceMap": true,
/* Strict Type-Checking Options */
"strict": true,
"noImplicitAny": false,
"esModuleInterop": true,
/* Advanced Options */
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
}
}