-
Notifications
You must be signed in to change notification settings - Fork 20
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
Error 'cannot find name ...' using karma-typescript-preprocessor plugin #29
Comments
+1 |
+1 I have the same issue. I added |
Just a question to everyone on this thread...does your definitions file have jasmine specified as dependency? |
In my case yes: |
Hmmm...I had the typings in the head of my files too and never got that error. Couldn't get the preprocessor to work nicely for me when using modules (switched to using Webpack + awesome-typescript-loader). |
That'd probably work, but I'd rather fix it altogether then. Might take a look at some point. Thanks though :) |
Hi, i was getting a similar problem but with my own classes. Two important things to comment here:
Next, you could download the definition files of more than a thousand of libraries from https://github.com/borisyankov/DefinitelyTyped or maybe better, you should read about TSD: http://webstackoflove.com/use-typescript-definition-manager-for-adding-type-definitions-to-your-project/ With those two things, the half of the problems should be gone The second, and most important, for your own code, classes or files, the thing is this
BUT for this to make it to work, you must change the DEFAULT value of the 'noResolve' directive to false on the 'typescriptPreprocessor' directive (karma.conf.js), or otherwise the preprocessor.typescript will keep logging errors. I waste a lot of time, figuring this out :( @sergeyt Could you change this behavior on upcoming releases and set the default value to false? so others dont face the same issue. I mean, this is a great tool (great work!), and some people opt to differents solutions like @gonzofish went with webpack or in here http://stackoverflow.com/questions/29912082/error-cannot-find-name-using-karma-typescript-preprocessor-plugin with gulp Thanks! |
I use mocha and the errors went away after:
|
using typings option or including explicit references on type definitions should help to deal with this issue |
Hi,
I am trying to automate unit test execution using grunt karma and karma-typescript-preprocessor.
However, when I run 'grunt watch', karma outputs the following error :
ERROR [preprocessor.typescript]: /home/loic/Code/appName/src/app/app.spec.ts.ktp.ts(15,13): error TS2304: Cannot find name 'expect'.
This error happens with a lot of names : 'describe, angular, expect 'etc
The strange thing is that when i run the command line 'tsc /path/to/app.spec.ts', the new js file is created, there is no error.
below my karma.conf.js :
Any help would be appreciated
The text was updated successfully, but these errors were encountered: