This is the structure of my project:
|_typetests
| |_type.test.ts
|
|
myproj.d.ts
tsconfig.json
Here is how my tsconfig.json file is configured:
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"lib": [
"es6"
],
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"types": [
"node",
"mocha"
],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": "./"
},
"include": [
"types/*.test.ts"
],
"exclude": ["node_modules"]
}
Running
./node_modules/.bin/tsc -p . --traceResolution
Shows the successful resolution of module name 'myproj' to '/Users/paulcowan/projects/myproj/myproj.d.ts'
However, when I run this command using mocha:
./node_modules/.bin/mocha -r ts-node/register types/*.test.ts
I encounter the following error:
Error: Cannot find module 'myproj'