Skip to content
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 [compiler.karma-typescript] however Karma doesn't fail #30

Closed
typeofweb opened this issue Nov 16, 2016 · 3 comments
Closed

ERROR [compiler.karma-typescript] however Karma doesn't fail #30

typeofweb opened this issue Nov 16, 2016 · 3 comments

Comments

@typeofweb
Copy link

Whenever there's a compilation error, eg:

ERROR [compiler.karma-typescript]: src/hello.component.ts(9,16): error TS2322: Type 'string' is not assignable to type 'void'.

Karma should fail too. Instead, it continues and tests may pass even if there are TypeScript compilation errors.

Is there any way to avoid this behaviour?

Example output:

16 11 2016 13:50:33.253:ERROR [compiler.karma-typescript]: src/hello.component.ts(9,16): error TS2322: Type 'string' is not assignable to type 'void'.

16 11 2016 13:50:33.259:INFO [compiler.karma-typescript]: Compiled 3 files in 1160 ms.
16 11 2016 13:50:33.761:INFO [builtin-bundler.karma-typescript]: Bundled imports for 1 file in 0 ms.
16 11 2016 13:50:33.762:INFO [watcher]: Changed file "/Users/miszy/htdocs/karma-typescript/example-project/src/hello.component.ts".
PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 1 of 1 SUCCESS (0.003 secs / 0.001 secs)
erikbarke added a commit that referenced this issue Nov 16, 2016
@monounity
Copy link
Owner

Hey @mmiszy, you can set noEmitOnError to true in either tsconfig.json or in the karma conf:

karmaTypescriptConfig: {
    compilerOptions: {
         noEmitOnError: true,
         //...
    },
    //...
}

This will make karma exit in quite a spectacular way, I've added this feature to the documentation!

@typeofweb typeofweb reopened this Nov 16, 2016
@typeofweb
Copy link
Author

This will make karma exit in quite a spectacular way

Indeed it makes Karma exit. However what I wanted to achieve is for Karma not to quit, but just to report the error and keep on watching files for changes. Is it possible?

@monounity
Copy link
Owner

It doesn't seem like this will be easy to implement, Karma seems to be kind of "binary", it either runs the tests or it quits, it's discussed here in a somewhat similar issue: karma-runner/karma#550.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants