5

I am trying to integrate automated testing using Ember Testing.

The application runs fine on browser, without any errors. I tried simply running

ember test

on command line, but get a bunch of global errors and all the tests fail.

These are the errors I'm getting:

not ok 1 PhantomJS 2.1 - Global error: SyntaxError: Unexpected token ',' at http://localhost:4302/assets/vendor.js, line 145617

not ok 2 PhantomJS 2.1 - Global error: Error: Could not find module ember-metal/core required by: ember-testing/index at http://localhost:4302/assets/test-support.js, line 62

not ok 3 PhantomJS 2.1 - Global error: ReferenceError: Can't find variable: define at http://localhost:4302/assets/tests.js, line 1

...

When I run the tests on the browser, I do not get the syntax error (first one above), the first error is

Uncaught Error: Could not find module `analogue/resolver` imported from `analogue/tests/helpers/resolver`

These don't make sense to me since I shouldn't be editing vendor.js and the modules it says it cannot find are there. Any ideas?

roca323
  • 455
  • 2
  • 8
  • 26

2 Answers2

3

In case anyone else (like me) ends up here with a similar problem.

In my case the list of errors always started with a random SyntaxError (sometimes about '(' or '!'). The actual referenced line usually never even contained these symbols.

The solution for me was to downgrade phantomjs from 2.1 to a 1.9 version

npm install -g phantomjs@1.9.20

(use nvm or nave to make your life easier in these cases)

Ivo van der Wijk
  • 16,341
  • 4
  • 43
  • 57
0

In my case I just needed a fresh PhantomJS installation

npm uninstall phantomjs -g
npm install phantomjs -g
Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130