-
-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compilation error with mocha and TypeScript 2.0 on Windows 10 #168
Comments
Same issue here, and the triple slash workaround also worked for me. |
Same issue here (although it's occurring w/ @types/protractor and not mocha), on Windows with ts-node@1.4.3. The triple-slash fix worked for me. |
Same issue on Ubuntu using @types - triple slash also fixed it for me. |
Giving |
@budiadiono Can you elaborate? I added that to my {
"compilerOptions": {
"types": [ "node", "mocha", "chai", "bunyan", "lodash"],
"typeRoots": ["typings"]
}
} I've also tried specifying the
I was able to resolve this issue by adding this block to my {
"include": [ "**/*.ts" ],
} |
@jamelt, maybe you forgot to install |
I had similar issue of ts-node on windows not finding protractor types under node_modules/@types without explicit edit: Actually include was not the key since I forgot explicit edi2: And for the reference |
this works for me. |
This doesn't work so well for node library types though (would have to add each individually), and adding node to types in compilerOptions causes conflicts in ts-node if another module also uses node typings.
|
Closing in favour of #216. It looks like all the issues stem from Windows and I'd guess it's a path issue with TypeScript (they do some odd escaping and expect inputs escaped in certain ways - possibly it's a related issue to this). If someone finds the cause, feel free to submit a PR. If you're working around it, use |
Without this we're getting an error while using ts-node on Windows. See TypeStrong/ts-node#168 TypeStrong/atom-typescript#1055 Note that this works around the issue but as far as I understand things it shouldn't be necessary.
definitions. See TypeStrong/ts-node#168 for more info
Settings for types could be set in tsconfig.json under "types": [...]. However, this method only works for Mac. On Windows 10, pathing is done differently so it cannot locate the type definitions. We must specify absolute paths to these types to make it compatible with Windows 10. TypeStrong/ts-node#168
I was running into a very similar problem, ensuring yarn add -D @types/mocha {
"types": [
"mocha"
],
"typeRoots": [
"./node_modules/@types"
]
} |
@wrumsby, thanks, that worked for me as well! |
The only thing that worked for me in Ubuntun 17.04 was:
and adding this to tsconfig.json
thanks @wrumsby |
I'm trying to run mocha tests using
--compilers ts:ts-node/register
with TypeScript 2.0 but get the following error only on Windows (10) while it works flawlessly on a Mac -You can replicate the issue using the following steps -
I managed to get it working on Windows by adding a triple slash reference to mocha type definition
/// <reference path="../node_modules/@types/mocha/index.d.ts" />
totest/greeter-spec.ts
but it seems redundant since it works flawlessly without it on Mac.The text was updated successfully, but these errors were encountered: