computmaxer / karma-jspm

Other
74 stars 50 forks source link

Browsers disconnect when encountering syntax error #128

Closed FrederikNJS closed 8 years ago

FrederikNJS commented 8 years ago

I have been fiddling around with karma-jspm for a bit, the only real problem I have encountered is that whenever I make a syntax error, and the tests run, then both Chrome and PhantomJS disconnects, and I have to restart karma to get it up and running again.

This issue does not happen when running the same code directly in karma, without karma-jspm.

When a syntax error occurs without karma-jspm, I get the following error, and the browers continue running, such that I can just fix the error, and karma continues:

18 02 2016 09:29:12.790:WARN [karma]: No captured browser, open http://localhost:9876/
18 02 2016 09:29:12.797:INFO [karma]: Karma v0.13.21 server started at http://localhost:9876/
18 02 2016 09:29:12.801:INFO [launcher]: Starting browser Chrome
18 02 2016 09:29:12.807:INFO [launcher]: Starting browser PhantomJS
18 02 2016 09:29:13.101:INFO [PhantomJS 2.1.1 (Linux 0.0.0)]: Connected on socket /#EMaCyNUAOFyHgyoJAAAA with id 31931963
18 02 2016 09:29:13.308:INFO [Chrome 48.0.2564 (Linux 0.0.0)]: Connected on socket /#9iw2MLL1sE0HSSm4AAAB with id 77150350
PhantomJS 2.1.1 (Linux 0.0.0): Executed 1 of 1 SUCCESS (0.04 secs / 0 secs)
Chrome 48.0.2564 (Linux 0.0.0): Executed 1 of 1 SUCCESS (0.008 secs / 0 secs)
TOTAL: 2 SUCCESS
18 02 2016 09:31:28.118:INFO [watcher]: Changed file "/home/frederiknjs/Code/personal/karma/test/test.js".
PhantomJS 2.1.1 (Linux 0.0.0) ERROR
  SyntaxError: Expected token '{'
  at /home/frederiknjs/Code/personal/karma/test/test.js:4

Chrome 48.0.2564 (Linux 0.0.0) ERROR
  Uncaught SyntaxError: Unexpected token }
  at /home/frederiknjs/Code/personal/karma/test/test.js:4

18 02 2016 09:31:45.144:INFO [watcher]: Changed file "/home/frederiknjs/Code/personal/karma/test/test.js".
Chrome 48.0.2564 (Linux 0.0.0): Executed 1 of 1 SUCCESS (0.003 secs / 0 secs)
PhantomJS 2.1.1 (Linux 0.0.0): Executed 1 of 1 SUCCESS (0.04 secs / 0 secs)
TOTAL: 2 SUCCESS

When running with karma-jspm, then the error is much less readable (especially in phantomjs), but the browsers also disconnect, making it necessary to restart karma:

18 02 2016 10:42:52.653:WARN [karma]: No captured browser, open http://localhost:9876/
18 02 2016 10:42:52.663:INFO [karma]: Karma v0.13.21 server started at http://localhost:9876/
18 02 2016 10:42:52.667:INFO [launcher]: Starting browser Chrome
18 02 2016 10:42:52.674:INFO [launcher]: Starting browser PhantomJS
18 02 2016 10:42:52.887:INFO [PhantomJS 2.1.1 (Linux 0.0.0)]: Connected on socket /#cOiK30zEIaTREyB9AAAA with id 83316136
18 02 2016 10:42:53.055:INFO [Chrome 48.0.2564 (Linux 0.0.0)]: Connected on socket /#SkaKlE8y7JOaCcYwAAAB with id 5461779
PhantomJS 2.1.1 (Linux 0.0.0): Executed 1 of 1 SUCCESS (0.029 secs / 0 secs)
Chrome 48.0.2564 (Linux 0.0.0): Executed 1 of 1 SUCCESS (0.006 secs / 0.001 secs)
TOTAL: 2 SUCCESS
18 02 2016 10:42:58.810:INFO [watcher]: Changed file "/home/frederiknjs/Code/personal/karma/test/test.js".
PhantomJS 2.1.1 (Linux 0.0.0) ERROR: 'Potentially unhandled rejection [3] eval@[native code]
__exec@http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:1395:16
execute@http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:3521:20
linkDynamicModule@http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:3126:36
link@http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:2969:28
execute@http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:3301:17
doDynamicExecute@http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:703:32
link@http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:905:36
doLink@http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:557:11
updateLinkSetOnLoad@http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:605:24
http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:417:30
tryCatchReject@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:1252:34
runContinuation1@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:1211:18
when@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:999:20
run@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:890:17
_drain@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:166:22
drain@http://localhost:9876/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:131:15'

Chrome 48.0.2564 (Linux 0.0.0) ERROR: 'Potentially unhandled rejection [3] SyntaxError: Unexpected token }
    Evaluating http://localhost:9876/base/test/test.js
    Error loading http://localhost:9876/base/test/test.js
    at eval (native)
    at SystemJSLoader.__exec (http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:1395:16)
    at entry.execute (http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:3521:16)
    at linkDynamicModule (http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:3126:32)
    at link (http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:2969:11)
    at Object.execute (http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:3301:13)
    at doDynamicExecute (http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:703:25)
    at link (http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:905:20)
    at doLink (http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:557:7)
    at updateLinkSetOnLoad (http://localhost:9876/base/jspm_packages/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:605:18)'

18 02 2016 10:43:09.103:WARN [PhantomJS 2.1.1 (Linux 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.

18 02 2016 10:43:09.168:WARN [Chrome 48.0.2564 (Linux 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.

18 02 2016 10:43:16.829:INFO [watcher]: Changed file "/home/frederiknjs/Code/personal/karma/test/test.js".
18 02 2016 10:43:17.082:WARN [karma]: No captured browser, open http://localhost:9876/

Is there anyway I can make the browsers continue after encountering a syntax error?