karma-runner / karma-edge-launcher

A Karma plugin. Launcher for Microsoft Edge.
MIT License
21 stars 7 forks source link

Expected identifier, string or number #2

Closed webmaster128 closed 6 years ago

webmaster128 commented 6 years ago

Hi all,

when I try to test an Angular app using Edge, I get the errors

  1. "Unable to get property 'call' of undefined or null reference"
  2. "Expected identifier, string or number"

My application code does not contain any call of call and the same tests run fine using the Chrome, Safari and Firefox launchers.

The browser opens but is stuck before running any tests:

bildschirmfoto vom 2018-02-26 12-49-27

Command line output

        nice -n 19 node ./node_modules/@angular/cli/bin/ng test --poll 10000
26 02 2018 12:41:28.477:WARN [karma]: No captured browser, open http://localhost:9876/
26 02 2018 12:41:28.492:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9876/
26 02 2018 12:41:28.492:INFO [launcher]: Launching browser Edge with unlimited concurrency
26 02 2018 12:41:28.508:INFO [launcher]: Starting browser Edge
26 02 2018 12:41:44.336:WARN [karma]: No captured browser, open http://localhost:9876/
26 02 2018 12:41:44.467:INFO [Edge 16.16299.0 (Windows 10.0.0)]: Connected on socket rgK-v4-Yuwicr711AAAA with id 56373409
26 02 2018 12:41:45.301:INFO [Edge 16.16299.0 (Windows 10.0.0)]: Connected on socket t08o5hwn8jk6LNyuAAAB with id 63248498
26 02 2018 12:41:45.301:INFO [karma]: Delaying execution, these browsers are not ready: Edge 16.16299.0 (Windows 10.0.0)
Edge 16.16299.0 (Windows 10.0.0) ERROR
  Expected identifier, string or number
  at http://localhost:9876/_karma_webpack_/vendor.bundle.js:107173

Edge 16.16299.0 (Windows 10.0.0) ERROR
  Expected identifier, string or number
  at http://localhost:9876/_karma_webpack_/vendor.bundle.js:107173

26 02 2018 12:41:45.624:INFO [Edge 16.16299.0 (Windows 10.0.0)]: Connected on socket f62tmxfth5DwjpGLAAAC with id 31627648
26 02 2018 12:41:45.628:INFO [karma]: Delaying execution, these browsers are not ready: Edge 16.16299.0 (Windows 10.0.0), Edge 16.16299.0 (Windows 10.0.0)
Edge 16.16299.0 (Windows 10.0.0) ERROR
  Unable to get property 'call' of undefined or null reference
  at http://localhost:9876/_karma_webpack_/inline.bundle.js:55

Edge 16.16299.0 (Windows 10.0.0) ERROR
  Unable to get property 'call' of undefined or null reference
  at http://localhost:9876/_karma_webpack_/inline.bundle.js:55

Edge 16.16299.0 (Windows 10.0.0) ERROR
  Expected identifier, string or number
  at http://localhost:9876/_karma_webpack_/vendor.bundle.js:107173

Edge 16.16299.0 (Windows 10.0.0) ERROR
  Expected identifier, string or number
  at http://localhost:9876/_karma_webpack_/vendor.bundle.js:107173

Edge 16.16299.0 (Windows 10.0.0) ERROR
  Expected identifier, string or number
  at http://localhost:9876/_karma_webpack_/vendor.bundle.js:107173

Edge 16.16299.0 (Windows 10.0.0) ERROR
  Expected identifier, string or number
  at http://localhost:9876/_karma_webpack_/vendor.bundle.js:107173
Edge 16.16299.0 (Windows 10.0.0) ERROR
  Expected identifier, string or number
  at http://localhost:9876/_karma_webpack_/vendor.bundle.js:107173

Edge 16.16299.0 (Windows 10.0.0) ERROR
  Expected identifier, string or number
  at http://localhost:9876/_karma_webpack_/vendor.bundle.js:107173

Edge 16.16299.0 (Windows 10.0.0) ERROR
  Expected identifier, string or number
  at http://localhost:9876/_karma_webpack_/vendor.bundle.js:107173

Edge 16.16299.0 (Windows 10.0.0) ERROR
  Expected identifier, string or number
  at http://localhost:9876/_karma_webpack_/vendor.bundle.js:107173
webmaster128 commented 6 years ago

The error appears in this line 107173:61

const { request, request: { user, method, url, async, password, headers, body } } = this;

so we're right after async. Seems like the variable is interpreted as a keyword.

After changing "target": "es2015", to "target": "es5", in tsconfig.json, the tests start running.

In any case, this is not this project's bug.

nickserv commented 6 years ago

Great, thanks for the clarification. 😄

Besides that is karma-edge-launcher working okay for you? I haven't tested it with recent versions of Edge and Windows 10.

webmaster128 commented 6 years ago

I have the strange behaviour that old tabs are always opened. So when running tests with --single-run 100 times, 100 tabs are open. But I did not dig into that since there are other problems to be solved first

webmaster128 commented 6 years ago

In case anyone finds this thread from Google: I hit this Edge/Chakra bug: https://github.com/Microsoft/ChakraCore/issues/4741

The reason this works with es5 is that es5 has no destructuring assignment and thus,

const { request, request: { user, method, url, async, password, headers, body } } = this;

is transpiled into

var _a = this, request = _a.request, _b = _a.request, user = _b.user, method = _b.method, url = _b.url, async = _b.async, password = _b.password, headers = _b.headers, body = _b.body;

which is a workaround for the Chakra bug.