Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EmberJS global error when running tests

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?

like image 611
roca323 Avatar asked Oct 18 '22 05:10

roca323


1 Answers

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 [email protected]

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

like image 186
Ivo van der Wijk Avatar answered Oct 21 '22 01:10

Ivo van der Wijk