Skip to content

Commit fc12c6d

Browse files
Merge pull request #1188 from emberjs/nvp/fix-barrel-deprecation
Resolve ember barrel deprecations
2 parents d39f14c + 2b9e8ef commit fc12c6d

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

addon/src/index.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/* globals Testem */
22
import { macroCondition, getOwnConfig, importSync } from '@embroider/macros';
3+
import { setTesting } from '@ember/debug';
4+
import { setAdapter } from 'ember-testing/lib/test/adapter';
35

46
/**
57
* Load qunit-default theme by default, if no custom theme is specified.
@@ -32,7 +34,6 @@ if (typeof Testem !== 'undefined') {
3234

3335
import { _backburner } from '@ember/runloop';
3436
import { resetOnerror, getTestMetadata } from '@ember/test-helpers';
35-
import Ember from 'ember';
3637
import * as QUnit from 'qunit';
3738
import QUnitAdapter from './adapter';
3839
import {
@@ -127,7 +128,7 @@ export function startTests() {
127128
@method setupTestAdapter
128129
*/
129130
export function setupTestAdapter() {
130-
Ember.Test.adapter = QUnitAdapter.create();
131+
setAdapter(QUnitAdapter.create());
131132
}
132133

133134
/**
@@ -138,13 +139,11 @@ export function setupTestAdapter() {
138139
*/
139140
export function setupEmberTesting() {
140141
QUnit.testStart(() => {
141-
// eslint-disable-next-line ember/no-ember-testing-in-module-scope
142-
Ember.testing = true;
142+
setTesting(true);
143143
});
144144

145145
QUnit.testDone(() => {
146-
// eslint-disable-next-line ember/no-ember-testing-in-module-scope
147-
Ember.testing = false;
146+
setTesting(false);
148147
});
149148
}
150149

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import Ember from 'ember';
1+
import { isTesting } from '@ember/debug';
22
import { module, test } from 'qunit';
33

44
module('setupEmberTesting', function () {
5-
test('Ember.testing is true in all test contexts', function (assert) {
6-
assert.true(Ember.testing);
5+
test('isTesting() is true in all test contexts', function (assert) {
6+
assert.true(isTesting());
77
});
88
});

test-app/tests/unit/setup-ember-onerror-validation-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import Ember from 'ember';
21
import { module } from 'qunit';
32
import { setupEmberOnerrorValidation } from 'ember-qunit';
3+
import { getOnerror, setOnerror } from '@ember/-internals/error-handling';
44

55
module('setupEmberOnerrorValidation', function (hooks) {
66
hooks.beforeEach(function (assert) {
@@ -12,14 +12,14 @@ module('setupEmberOnerrorValidation', function (hooks) {
1212
originalPushResult(resultInfo);
1313
};
1414

15-
this.originalEmberOnerror = Ember.onerror;
16-
Ember.onerror = function () {
15+
this.originalEmberOnerror = getOnerror();
16+
setOnerror(function () {
1717
// intentionally swallowing here
18-
};
18+
});
1919
});
2020

2121
hooks.afterEach(function () {
22-
Ember.onerror = this.originalEmberOnerror;
22+
setOnerror(this.originalEmberOnerror);
2323
});
2424

2525
setupEmberOnerrorValidation();

0 commit comments

Comments
 (0)