I have the following project structure
|_typetests
| |_type.test.ts
|
|
myproj.d.ts
tsconfig.json
My tsconfig.json looks like this:
{
"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"]
}
If I run ./node_modules/.bin/tsc -p . --traceResolution
Then I can see:
Module name 'myproj' was successfully resolved to '/Users/paulcowan/projects/myproj/myproj.d.ts'. ========
But when I run the following through mocha
./node_modules/.bin/mocha -r ts-node/register types/*.test.ts
Error: Cannot find module 'myproj'