You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had an issue compiling mocha unit test with ts-node as it could not find the mocha d.ts in @types. Do I really have to import mocha this way to have describe, it ... declared ?
import*asmochafrom'mocha';
Normally it should load the d.ts automatically as not excluded in tsconfig. Or am I missing something ?
Error
node_modules\ts-node\dist\index.js:160 throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset)); ^ TSError: ⨯ Unable to compile TypeScript test\test.ts (7,1): Cannot find name 'describe'. (2304) test\test.ts (10,3): Cannot find name 'beforeEach'. (2304) test\test.ts (12,3): Cannot find name 'it'. (2304) npm ERR! Test failed. See above for more details.
Please see the existing issue, thanks. If you manage to find the issue, that would be useful, but so far it seems related to Windows and is probably a path issue with TypeScript.
Activity
blakeembrey commentedon Dec 7, 2016
Please see the existing issue, thanks. If you manage to find the issue, that would be useful, but so far it seems related to Windows and is probably a path issue with TypeScript.
paulsouche commentedon Dec 7, 2016
Ok I found it ! I had to
/// <reference types="mocha" />To declare mocha as ambient.
I do not understand of which existing issue you're talking about ? But mine can be closed now.
Thanks anyway
blakeembrey commentedon Dec 7, 2016
Try #168 or #216.