Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Preprocessor failure should cancel (not even start) the execution #550

Closed
hlship opened this Issue · 5 comments

4 participants

@hlship

When I have errors in my CoffeeScript, I see two problems:

1) The compilation error is reported without a line number, making it hard to chase down the problem.

INFO [watcher]: Changed file "/Users/hlship/workspaces/annadale/nexus/client/novate-console/src/test/unit/api-services-spec.coffee".
ERROR [preprocess.coffee]: unexpected INDENT
  at /Users/hlship/workspaces/annadale/nexus/client/novate-console/src/test/unit/api-services-spec.coffee
Chrome 26.0 (Mac) LOG: '{\n  "a": 1,\n  "b": 2\n}'
Chrome 26.0 (Mac): Executed 5 of 5 SUCCESS (0.457 secs / 0.068 secs)

2) The test runner reports success for the tests that did run; however, the test run should be a failure if any sources could not be compiled. In the above, the 5 tests that ran passed, but there were another 7 that never executed due to the compilation error.

This is in Karma 0.8.5.

@vojtajina vojtajina referenced this issue in karma-runner/karma-coffee-preprocessor
Open

Better error reporting #4

@vojtajina

Totally. I created a separate issue for the coffee-preprocessor plugin (to report line numbers).

Any failure during preprocessing should fail the whole run. Probably even not run.

@vojtajina

Just updated the issue title.

@nc
nc commented

+1

@Neppord

1+

@vojtajina vojtajina closed this issue from a commit
@vojtajina vojtajina feat(preprocessor): allow preprocessor to cancel test run
Now a preprocessor can return an error, which
  - stops preprocessing (does not trigger other preprocessors),
  - cancels the test run.

This changes the preprocessor API - preprocessor's `done` function accepts two arguments:
  - an error (`null` if no error),
  - content.

The change is done in a backwards compatible way - if a preprocessor calls `done` with a single
string argument, it is treated as no error.

Closes #550
4d669bf
@vojtajina vojtajina closed this in 4d669bf
@vojtajina

I fixed this in the coffee preprocessor, but it will be available with Karma 0.12, as this is a breaking change (it's in https://github.com/karma-runner/karma-coffee-preprocessor/tree/preprocessor-error-karma-0.11.14).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.