All default Component Integration Tests are (4, 0, 4) undefined


#1

I am completely new to testing in Ember (testing in general). I am following the Ember 2.x course at Front End Masters and I have generated several components via ember-cli. When I go to http://localhost:4200/tests, each of these components returns an identical set of errors.

Integration | Component | my component it renders (4, 0, 4)
1. Uncaught TypeError: Cannot read property 'extend' of undefined
Source: http://localhost:4200/assets/vendor.js:43347

2. Died on test #2     at Object.test (http://localhost:4200/assets/test-support.js:1997:11)
at http://localhost:4200/assets/github-ui.js:2076:15
at mod.state (http://localhost:4200/assets/vendor.js:150:29)
at tryFinally (http://localhost:4200/assets/vendor.js:30:14)
at requireModule (http://localhost:4200/assets/vendor.js:148:5)
at Object.TestLoader.require (http://localhost:4200/assets/test-loader.js:29:9)
at Object.TestLoader.loadModules (http://localhost:4200/assets/test-loader.js:21:18): Cannot read property 'render' of undefined
Source: 	
TypeError: Cannot read property 'render' of undefined
at http://localhost:4200/assets/github-ui.js:2082:9
at Object.wrapper (http://localhost:4200/assets/test-support.js:1979:29)
at Object.Test.run (http://localhost:4200/assets/test-support.js:3660:28)
at http://localhost:4200/assets/test-support.js:3789:11
at process (http://localhost:4200/assets/test-support.js:3348:24)
at begin (http://localhost:4200/assets/test-support.js:3393:2)
at http://localhost:4200/assets/test-support.js:3409:4

3. Uncaught TypeError: Cannot read property 'subject' of undefined
Source: http://localhost:4200/assets/vendor.js:43347

4. Expected 2 assertions, but 3 were run
Source: 	
at Object.test (http://localhost:4200/assets/test-support.js:1997:11)
at http://localhost:4200/assets/github-ui.js:2076:15
at mod.state (http://localhost:4200/assets/vendor.js:150:29)
at tryFinally (http://localhost:4200/assets/vendor.js:30:14)
at requireModule (http://localhost:4200/assets/vendor.js:148:5)
at Object.TestLoader.require (http://localhost:4200/assets/test-loader.js:29:9)
at Object.TestLoader.loadModules (http://localhost:4200/assets/test-loader.js:21:18)

These are the default tests. I have not made any modifications. These components are working as expected in my app. What do I need to do?

Additional details:

DEBUG: -------------------------------
DEBUG: Ember      : 2.4.1
DEBUG: Ember Data : 2.5.0-beta.1+1327e0755b
DEBUG: jQuery     : 1.12.1
DEBUG: -------------------------------

#2

Solved my own issue.

Turns out that despite installing the latest version of ember-cli, it was still operating on ember cli 1.13.1; I think the culprit was NVM. Since I don’t need NVM, I removed it from my system, reinstalled node, npm and bower, and then was able to install the right version of ember-cli for the project.

After following the project upgrade instructions, I was able to get ember-cli up to version 2.4.2 and the tests are now running as expected.


#3

The issue is that when you type $ember you get the globally installed version of ember-cli. My preferred way to avoid this is to create scripts in the package.json file in run them:

// package.json
...
"scripts":{
   "test": "ember test",
 ....

Then, when you run npm test node will use the ember executable in your local node_moduels directory rather than the globally installed one.

I"ve also got this neat little alias:

alias npm-exec='PATH=$(npm bin):$PATH'

You can use it to run executables: npm-exec ember and it will always use the executable that is local to the project rather than the global.


#4

Thank you for the answer. I’ll keep this in mind should I ever have to run Ember apps with different versions.