unit-testingember.jsphantomjsqunitember-qunit

Tests total failure after abrupt Ember upgrade


I am working on an app that was stuck for a while on Ember 2.2, and we finally devoted the time to make the upgrade to Ember 2.10. After fixing all the deprecation warnings in the code, and upgrading the versions of some of the dependencies accordingly, we finally got the app to work 100% in the browser. However, when we now run the ember tests, they fail in a fatal way (i.e. the tests are not even run).

This is the output of the ember test command:

$ ember test
cleaning up...
Built project successfully. Stored in "/Users/ernesto/code/my-app/frontend/tmp/core_object-tests_dist-oanj8mZd.tmp".
not ok 1 Browser "phantomjs /Users/ernesto/code/my-app/frontend/node_modules/testem/assets/phantom.js http://localhost:7357/4233/tests/index.html?hidepassed" failed to connect. testem.js not loaded?

1..1
# tests 1
# pass  0
# skip  0
# fail  1
Not all tests passed.
Error: Not all tests passed.
    at EventEmitter.App.getExitCode (/Users/ernesto/code/my-app/frontend/node_modules/testem/lib/app.js:434:15)
    at EventEmitter.App.exit (/Users/ernesto/code/my-app/frontend/node_modules/testem/lib/app.js:189:23)
    at /Users/ernesto/code/my-app/frontend/node_modules/testem/lib/app.js:103:14
    at tryCatcher (/Users/ernesto/code/my-app/frontend/node_modules/testem/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/ernesto/code/my-app/frontend/node_modules/testem/node_modules/bluebird/js/release/promise.js:510:31)
    at Promise._settlePromise (/Users/ernesto/code/my-app/frontend/node_modules/testem/node_modules/bluebird/js/release/promise.js:567:18)
    at Promise._settlePromise0 (/Users/ernesto/code/my-app/frontend/node_modules/testem/node_modules/bluebird/js/release/promise.js:612:10)
    at Promise._settlePromises (/Users/ernesto/code/my-app/frontend/node_modules/testem/node_modules/bluebird/js/release/promise.js:691:18)
    at Async._drainQueue (/Users/ernesto/code/my-app/frontend/node_modules/testem/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/Users/ernesto/code/my-app/frontend/node_modules/testem/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/ernesto/code/my-app/frontend/node_modules/testem/node_modules/bluebird/js/release/async.js:17:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)

The only clue that I can extract from this error message is where it says testem.js not loaded?. How can I check if this is what is happening, and if so, why is it not loading, and how can I make it load again?

I would appreciate if someone could please shed some light as to what might be going on here.


Solution

  • Ok, I eventually found the cause of the problem, so I'm answering this here for completeness and future reference.

    The tests/index.html file needed some changes to properly address where the testem.js file is located after the Ember version change. So instead of this:

    <script src="testem.js" integrity=""></script>
    

    I had to add a / in front of the src attr value. It ended up looking like this:

    <script src="/testem.js" integrity=""></script>
    

    We still have some other problems to fix, but the fatal failure thing we had before is gone.