Open solo-md opened 6 years ago
Figured out that after the file_list_modified event is emitted, and the browser is forced to EXECUTE state, and before the onStart method, the state is actually changed to READY.
The most interesting is that it happend because meantime karma send it's 'complete' event. And the complete event is sent because some WebSocket gets an 42["stop"]
event.
It is the case for my Win10 environment. Doesn't happen for macOS.
OK, Looks like it's because of https://github.com/karma-runner/karma/issues/1640 Can be closed as duplicate
Expected behaviour
Tests should run. Once a watched file is changed, tests should re-run.
Actual behaviour
First test runs perfectly fine. After that Browser.state (karma/lib/browser.js) is READY. Once a watched file is changed, tests re-run. But there is nothing that changes the browser state to EXECUTING, so once a spec is completed, the Browser's onResult is ignored (the check is commented with
// ignore - probably results from last run (after server disconnecting)
)Environment Details
karma --version
): 2.0.4karma.config.js
filePotential fix
I can easily fix the problem if I force the correct state of the browser in the onStart method. And it looks correct: once you in the Browser.onStart, you create a new instance of Browser.lastResult, and you set a fresh value of "Browser.lastResult.total", then you probably want to force the browser state to EXECUTING (as you've just started new test run).
But I don't get how it can happen that tests are started for the second time correctly, I can see the message
"Executed 0 of 88 SUCCESS ( 0 secs / 0 secs )"
, then all my specs are actually executed, but the Browser.onResult just ignores the results because of the wrong state.I didn't give up on that after my local fix, so I continue my investigation. Any idea or help with that issue is very much appreciated!