Skip to content

Commit

Permalink
[cleanup]: Remove implicit store injection slated for Ember v4.0.0 (#… (
Browse files Browse the repository at this point in the history
#7736)

* [cleanup]: Remove implicit store injection slated for Ember v4.0.0 (#7667)

* CI timeouts testing bump (#7734)

Co-authored-by: Scott Newcomer <snewcomer@users.noreply.github.com>
  • Loading branch information
igorT and snewcomer committed Nov 4, 2021
1 parent 933805e commit c178c64
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 60 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: yarn problems

test-infra:
timeout-minutes: 8
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -138,12 +138,12 @@ jobs:
- name: Install dependencies
run: yarn install --frozen-lockfile --network-timeout=300000
- name: Fastboot Test ${{ matrix.scenario }}
timeout-minutes: 6
timeout-minutes: 12
run: yarn test:fastboot ${{ matrix.scenario }}

browser-tests:
needs: [lint]
timeout-minutes: 20
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -175,15 +175,15 @@ jobs:
run: |
yarn run testem launchers
- name: Run Production Test
timeout-minutes: 8
timeout-minutes: 10
env:
TESTEM_CI_LAUNCHER: ${{ matrix.launcher }}
CI: true
run:
yarn test:production

floating-dependencies:
timeout-minutes: 6
timeout-minutes: 10
needs: [lint, basic-tests]
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -211,13 +211,13 @@ jobs:
- name: Install dependencies
run: yarn install
- name: Basic tests with ${{ matrix.scenario }}
timeout-minutes: 6
timeout-minutes: 10
env:
CI: true
run: yarn test:try-one ${{ matrix.scenario }}

releases:
timeout-minutes: 6
timeout-minutes: 10
needs: [lint, basic-tests]
if: |
github.event_name == 'pull_request' && (
Expand Down Expand Up @@ -247,7 +247,7 @@ jobs:
continue-on-error: ${{ matrix['continue-on-error'] == true }}

additional-scenarios:
timeout-minutes: 7
timeout-minutes: 8
needs: [lint, basic-tests]
strategy:
matrix:
Expand All @@ -274,7 +274,7 @@ jobs:

node-version-test:
name: Use Node.js ${{ matrix.node-version }}
timeout-minutes: 6
timeout-minutes: 8
needs: [lint, basic-tests]
runs-on: ubuntu-latest
strategy:
Expand Down
7 changes: 0 additions & 7 deletions packages/-ember-data/addon/setup-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ function initializeStore(application) {
}
}

function initializeStoreInjections(application) {
let inject = application.inject || application.injection;
inject.call(application, 'controller', 'store', 'service:store');
inject.call(application, 'route', 'store', 'service:store');
}

export default function setupContainer(application) {
initializeStoreInjections(application);
initializeStore(application);
}
3 changes: 0 additions & 3 deletions packages/-ember-data/app/initializers/ember-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import setupContainer from 'ember-data/setup-container';

/*
This code initializes EmberData in an Ember application.
It ensures that the `store` service is automatically injected
as the `store` property on all routes and controllers.
*/
export default {
name: 'ember-data',
Expand Down
37 changes: 0 additions & 37 deletions packages/-ember-data/tests/integration/injection-test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import Service from '@ember/service';

import { module, test } from 'qunit';

import { setupTest } from 'ember-qunit';

import Model from '@ember-data/model';

module('integration/injection factoryFor enabled', function (hooks) {
setupTest(hooks);
let store;
Expand Down Expand Up @@ -36,36 +32,3 @@ module('integration/injection factoryFor enabled', function (hooks) {
assert.equal(modelClass.modelName, 'super-villain', 'expected the factory itself to be returned');
});
});

module('integration/injection eager injections', function (hooks) {
setupTest(hooks);
let store;
let Apple = Service.extend();

hooks.beforeEach(function () {
let { owner } = this;

owner.register('model:foo', Model.extend());
owner.register('service:apple', Apple);
owner.inject('model:foo', 'apple', 'service:apple');

store = this.owner.lookup('service:store');
});

test('did inject', async function (assert) {
// TODO likely this test should instead test that we can use service injections
// on models (e.g. that owner is properly setup for it).
assert.expectDeprecation(
() => {
let foo = store.createRecord('foo');
let apple = foo.get('apple');
let appleService = this.owner.lookup('service:apple');

assert.ok(apple, `'model:foo' instance should have an 'apple' property`);
assert.ok(apple === appleService, `'model:foo.apple' should be the apple service`);
assert.ok(apple instanceof Apple, `'model:foo'.apple should be an instance of 'service:apple'`);
},
{ id: 'implicit-injections', count: 1, when: { ember: '>=3.27.0' } }
);
});
});
3 changes: 3 additions & 0 deletions packages/unpublished-fastboot-test-app/app/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

import { buildTree } from 'ember-simple-tree/utils/tree';

export default class IndexRoute extends Route {
@service store;

model() {
return this.store.findAll('person');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default Route.extend({
store: service(),
export default class PersonNewRoute extends Route {
@service store;

model() {
return this.store.createRecord('person');
},
});
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default Route.extend({
store: service(),

async model() {
performance.mark('start-data-generation');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

import { all } from 'rsvp';

export default Route.extend({
store: service(),

async model() {
performance.mark('start-data-generation');
const payload = await fetch('./fixtures/destroy.json').then((r) => r.json());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default Route.extend({
store: service(),

model() {
performance.mark('start-find-all');
return this.store.findAll('car', { reload: true }).then((cars) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import Route from '@ember/routing/route';
import { run } from '@ember/runloop';
import { inject as service } from '@ember/service';

export default Route.extend({
store: service(),

async model() {
performance.mark('start-data-generation');
const payload = await fetch('./fixtures/unload.json').then((r) => r.json());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

/**
* Measures the performance characteristics of pushing a large payload
* with tons of relationship data that will not be accessed.
*/
export default class UnusedRelationshipsRoute extends Route {
@service store;

async model() {
performance.mark('start-data-generation');

Expand Down

0 comments on commit c178c64

Please sign in to comment.