Esri / ember-cli-amd

Ember CLI Addon for using AMD libraries
Apache License 2.0
21 stars 15 forks source link

Broken in ember 2.4.1 #24

Closed mjuniper closed 7 years ago

mjuniper commented 8 years ago

In ember 2.4.1, the addon works, however, the tests break.

When I do ember test -s, I see:

Global error: Error: Could not find module `ember-cli/test-loader` imported from `(equireray)` at http://localhost:7357/assets/vendor.js, line 173

Global error: Error: Could not find module `ember-qunit` imported from `ember-test-app-2/tests/test-helper` at http://localhost:7357/assets/vendor.js, line 17
3

Error: Could not find module `ember-cli/test-loader` imported from `(equireray)` at http://localhost:7357/assets/vendor.js, line 173
Error: Could not find module `ember-qunit` imported from `ember-test-app-2/tests/test-helper` at http://localhost:7357/assets/vendor.js, line 173
jrowlingson commented 8 years ago

@mjuniper temporary workaround:

bower install jquery#2.1.4 && ember t -s
odoe commented 8 years ago

If the jQuery update worked for you @mjuniper could you verify and close the issue? Thanks!

mjuniper commented 8 years ago

Well, it did work but I don't understand why. Also, at ember 2.3+ (I think) you are not supposed to need to have jquery in your bower.json at all.

odoe commented 8 years ago

Well, that is just weird. I'll test a little further on this one before closing it.

jrowlingson commented 8 years ago

Also, at ember 2.3+ (I think) you are not supposed to need to have jquery in your bower.json at all.

This is correct.

I'll test a little further on this one before closing it.

I would suggest keeping the issue open until a proper fix is in place.

mjuniper commented 8 years ago

I would suggest keeping the issue open until a proper fix is in place.

I agree. Thanks @jrowlingson

odoe commented 8 years ago

This is really weird. Testing in Ember 2.4.3 and jQuery default install is 2.2.2, which breaks testem w/addon. Just going back to 2.1.4 does fix it, but I don't know why. Scripts are still loaded in same order, nothing jumps out.

I'll keep cracking away at it, thanks!

nwhittaker commented 8 years ago

I think I got to the bottom of this issue (at least for Backoffice). Briefly, I needed to reverse the order in which assets/test-loader.js and assets/test-support.js are referenced in tests/index.html.

Longer description from workforce-js#1294 (comment):

This change seems to resolve the issue described in Esri/ember-cli-amd#24. In short, I noticed that test-support.js loads modules out of test-loader.js -- despite test-loader getting pulled in after test-support. However, test-support loads the modules in a domready handler, so the problem was masked (w/ jQuery < 2.2) because test-loader is pulled in time. I noticed jQuery >= 2.2 changed its jQuery.ready() implementation, so I'm guessing it sped things up so that require no longer had enough time to pull in all the deps before domready was fired.

EDIT: Inline the comment because it's in a private repo.

nwhittaker commented 8 years ago

I see that ember-cli loads test-loader after test-support by default. I wonder if a better fix for this issue is to load the script resources in tests/index.html in parallel rather than serially (unless there's a reason to do it this way?) -- and use Require's shim config to indicate the order in which to load test-support and test-loader?

JaronAndre commented 7 years ago

FYI for anyone look at this issue now: This issues doesn't appear to exist with the latest version of Ember (2.10 is what I'm trying with). Ember has updated its QUint test suite to version 2 since this bug was filed so that may have removed the issue.