Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make build-registry work correctly when ember-data addon is used #138

Merged
merged 1 commit into from
Jan 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ module.exports = {
resolutions: {
"ember": "canary"
}
},
{
name: 'ember-data-2.3',
dependencies: {
"ember": "components/ember#release",
},
devDependencies: {
"ember-data": "~2.3"
},
resolutions: {
"ember": "release"
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I just realized that ember-try only works with bower dependencies for now. So I am not sure this config is really helpful to test the code path below 😔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, but it doesn't hurt...

}
]
};
12 changes: 10 additions & 2 deletions lib/ember-test-helpers/build-registry.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* globals global, self */
/* globals global, self, requirejs, require */

import Ember from 'ember';

Expand Down Expand Up @@ -98,7 +98,15 @@ export default function(resolver) {
}

var globalContext = typeof global === 'object' && global || self;
if (globalContext.DS) {
if (requirejs.entries['ember-data/setup-container']) {
// ember-data is a proper ember-cli addon since 2.3; if no 'import
// 'ember-data'' is present somewhere in the tests, there is also no `DS`
// available on the globalContext and hence ember-data wouldn't be setup
// correctly for the tests; that's why we import and call setupContainer
// here; also see https://github.com/emberjs/data/issues/4071 for context
var setupContainer = require('ember-data/setup-container')['default'];
setupContainer(registry || container);
} else if (globalContext.DS) {
var DS = globalContext.DS;
if (DS._setupContainer) {
DS._setupContainer(registry || container);
Expand Down