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

Ensure we are properly testing multiple Ember versions. #5123

Merged
merged 7 commits into from
Aug 16, 2017
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
4 changes: 0 additions & 4 deletions .bowerrc

This file was deleted.

13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
---
language: node_js
sudo: false
dist: trusty
node_js:
- "7"

cache:
yarn: true

before_install:
- "export PATH=$PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH"
- "if [ $(phantomjs --version) != '2.1.1' ]; then rm -rf $PWD/travis_phantomjs; mkdir -p $PWD/travis_phantomjs; fi"
- "if [ $(phantomjs --version) != '2.1.1' ]; then wget https://assets.membergetmember.co/software/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O $PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2; fi"
- "if [ $(phantomjs --version) != '2.1.1' ]; then tar -xvf $PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis_phantomjs; fi"
- "phantomjs --version"
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
- yarn global add phantomjs-prebuilt
- phantomjs --version

install:
- yarn
- ./node_modules/.bin/bower install
- yarn install --no-lockfile --no-interactive

script:
- ./bin/lint-features
Expand Down
6 changes: 5 additions & 1 deletion addon/-private/system/model/internal-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,11 @@ export default class InternalModel {
this.dematerializeRecord();

if (this._scheduledDestroy === null) {
this._scheduledDestroy = run.schedule('destroy', this, '_checkForOrphanedInternalModels');
// TODO: use run.schedule once we drop 1.13
if (!Ember.run.currentRunLoop) {
assert('You have turned on testing mode, which disabled the run-loop\'s autorun.\n You will need to wrap any code with asynchronous side-effects in a run', Ember.testing);
}
this._scheduledDestroy = Ember.run.backburner.schedule('destroy', this, '_checkForOrphanedInternalModels')
}
}

Expand Down
2 changes: 1 addition & 1 deletion addon/-private/system/relationships/state/has-many.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class ManyRelationship extends Relationship {
}
this.__loadingPromise.set('promise', promise)
} else {
this.__loadingPromise = new PromiseManyArray({
this.__loadingPromise = PromiseManyArray.create({
promise,
content
});
Expand Down
5 changes: 4 additions & 1 deletion addon/-private/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ function getOwner(context) {

if (owner && owner.lookupFactory && !owner._lookupFactory) {
// `owner` is a container, we are just making this work
owner._lookupFactory = owner.lookupFactory;
owner._lookupFactory = function() {
return owner.lookupFactory(...arguments);
}

owner.register = function() {
let registry = owner.registry || owner._registry || owner;

Expand Down
2 changes: 0 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ install:
# Typical npm stuff.
- md C:\nc
- appveyor-retry yarn install
# Workaround https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows
- yarn run bower
# Post-install test scripts.
test_script:
# Output useful info for debugging.
Expand Down
5 changes: 0 additions & 5 deletions bower.json

This file was deleted.

33 changes: 23 additions & 10 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ module.exports = {
scenarios: [
{
name: 'default',
bower: {
dependencies: { }
}
bower: { },
npm: { }
},
{
name: 'ember-1-13',
Expand All @@ -18,7 +17,9 @@ module.exports = {
}
},
npm: {
'ember-source': null
devDependencies: {
'ember-source': null
}
}
},
{
Expand All @@ -32,7 +33,9 @@ module.exports = {
}
},
npm: {
'ember-source': null
devDependencies: {
'ember-source': null
}
}
},
{
Expand All @@ -46,7 +49,9 @@ module.exports = {
}
},
npm: {
'ember-source': null
devDependencies: {
'ember-source': null
}
}
},
{
Expand All @@ -60,7 +65,9 @@ module.exports = {
}
},
npm: {
'ember-source': null
devDependencies: {
'ember-source': null
}
}
},
{
Expand All @@ -74,7 +81,9 @@ module.exports = {
}
},
npm: {
'ember-source': null
devDependencies: {
'ember-source': null
}
}
},
{
Expand All @@ -88,7 +97,9 @@ module.exports = {
}
},
npm: {
'ember-source': null
devDependencies: {
'ember-source': null
}
}
},
{
Expand All @@ -102,7 +113,9 @@ module.exports = {
}
},
npm: {
'ember-source': null
devDependencies: {
'ember-source': null
}
}
}
]
Expand Down
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const merge = require('broccoli-merge-trees');
const semver = require('semver');
const version = require('./lib/version');
const BroccoliDebug = require('broccoli-debug');
const calculateCacheKeyForTree = require('calculate-cache-key-for-tree');

// allow toggling of heimdall instrumentation
let INSTRUMENT_HEIMDALL = false;
Expand Down Expand Up @@ -213,6 +214,9 @@ module.exports = {
production: app.bowerDirectory + '/ember-data/ember-data.prod.js'
});
}
},

cacheKeyForTree(treeType) {
return calculateCacheKeyForTree(treeType, this);
}
};

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"node-tests": "node node-tests/nodetest-runner.js",
"test:optional-features": "ember test --environment=test-optional-features",
"test:production": "ember test --environment=production",
"bower": "bower install",
"production": "ember build --environment=production"
},
"author": "",
Expand All @@ -32,6 +31,7 @@
"broccoli-funnel": "^1.2.0",
"broccoli-merge-trees": "^2.0.0",
"broccoli-rollup": "^1.2.0",
"calculate-cache-key-for-tree": "^1.1.0",
"chalk": "^1.1.1",
"ember-cli-babel": "^6.4.1",
"ember-cli-path-utils": "^1.0.0",
Expand Down Expand Up @@ -61,7 +61,6 @@
"babel-plugin-transform-es2015-shorthand-properties": "^6.22.0",
"babel-plugin-transform-es2015-spread": "^6.22.0",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"bower": "^1.6.5",
"broccoli-asset-rev": "^2.4.5",
"broccoli-concat": "^3.2.2",
"broccoli-stew": "^1.4.2",
Expand Down
6 changes: 1 addition & 5 deletions tests/dummy/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ import Resolver from './resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';

let App;

Ember.MODEL_FACTORY_INJECTIONS = true;

App = Ember.Application.extend({
const App = Ember.Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver
Expand Down
20 changes: 20 additions & 0 deletions tests/helpers/model-factory-injection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Ember from 'ember';
import hasEmberVersion from 'ember-test-helpers/has-ember-version';

const ORIGINAL_MODEL_FACTORY_INJECTIONS = Ember.MODEL_FACTORY_INJECTIONS;

export function setup(value) {
if (arguments.length > 0) {
value = arguments[0];
} else {
value = true;
}

if (!hasEmberVersion(2, 14)) {
Ember.MODEL_FACTORY_INJECTIONS = value;
}
}

export function reset() {
setup(ORIGINAL_MODEL_FACTORY_INJECTIONS);
}
9 changes: 6 additions & 3 deletions tests/integration/injection-test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import {
setup as setupModelFactoryInjections,
reset as resetModelFactoryInjections
} from 'dummy/tests/helpers/model-factory-injection';
import setupStore from 'dummy/tests/helpers/store';
import Ember from 'ember';
import DS from 'ember-data';
import { module, test } from 'qunit';

let env, hasFactoryFor, originalLookupFactory, originalOwnerLookupFactory, originalFactoryFor;
let originalMODEL_FACTORY_INJECTIONS = Ember.MODEL_FACTORY_INJECTIONS;
const { run } = Ember;

const model = {
Expand Down Expand Up @@ -79,7 +82,7 @@ test('modelFor', function(assert) {

module('integration/injection eager injections', {
setup() {
Ember.MODEL_FACTORY_INJECTIONS = true;
setupModelFactoryInjections();
env = setupStore();

env.registry.injection('model:foo', 'apple', 'service:apple');
Expand All @@ -90,7 +93,7 @@ module('integration/injection eager injections', {

teardown() {
// can be removed once we no longer support ember versions without lookupFactory
Ember.MODEL_FACTORY_INJECTIONS = originalMODEL_FACTORY_INJECTIONS;
resetModelFactoryInjections();

run(env.store, 'destroy');
}
Expand Down
Loading