Skip to content
This repository has been archived by the owner on Sep 11, 2018. It is now read-only.

Error when running npm test in CircleCI #1324

Closed
EwanValentine opened this issue Aug 7, 2017 · 4 comments
Closed

Error when running npm test in CircleCI #1324

EwanValentine opened this issue Aug 7, 2017 · 4 comments

Comments

@EwanValentine
Copy link

I have an application built using this starter kit, which all works locally fine. However, when I run npm test as part of my build, I'm getting a strange error which seems to originate from PhantomJS


START:
PhantomJS 2.1.1 (Linux 0.0.0) ERROR
  ReferenceError: Can't find variable: Symbol
  at webpack:///~/zen-observable-ts/lib/zenObservable.js:394:0 <- tests/test-bundler.js:76335
PhantomJS 2.1.1 (Linux 0.0.0) ERROR
  ReferenceError: Can't find variable: Symbol
  at webpack:///~/zen-observable-ts/lib/zenObservable.js:394:0 <- tests/test-bundler.js:76335
@amangeot
Copy link

amangeot commented Aug 7, 2017

Same here, it's coming from an ES6 for of iterator.

It looks like PhantomJS needs to be polyfilled, I didn't manage to make it work yet.

@EwanValentine
Copy link
Author

Glad it's not just me! I've tried a few different versions of node without any luck. I've had to skip tests on build for now which is obviously not ideal...

@amangeot
Copy link

amangeot commented Aug 7, 2017

Try installing es6-symbol and es5-ext then adding this to the file normalize.js, it worked for me

// 4) Symbol
// ------------------------------------
// PhantomJS doesn't implement ES6 for.. of loops
if (typeof Symbol === 'undefined') {
  require('es6-symbol/implement')
}

if (typeof [][Symbol.iterator] === 'undefined') {
  require('es5-ext/array/#/@@iterator/implement')
}

The idea is to polyfill Symbol and array[Symbol.iterator] that for..of loops require

@dvdzkwsk
Copy link
Owner

dvdzkwsk commented Oct 5, 2017

Thanks @amangeot!

I realize I'm super late to the party, but for fixes like this I've opened up #1331 to accept new contributors, if any of you are interested.

@dvdzkwsk dvdzkwsk closed this as completed Oct 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants