File tree 5 files changed +19
-28
lines changed
5 files changed +19
-28
lines changed Original file line number Diff line number Diff line change 1
1
import setupMirage from './setup-mirage' ;
2
2
export { setupMirage } ;
3
3
4
- import { dependencySatisfies } from '@embroider/macros' ;
5
-
6
- if ( dependencySatisfies ( 'ember-qunit' , '*' ) ) {
4
+ if ( typeof window . QUnit !== 'undefined' ) {
7
5
window . QUnit . config . urlConfig . push ( {
8
6
id : 'mirageLogging' ,
9
7
label : 'Mirage logging' ,
Original file line number Diff line number Diff line change 1
1
import { deprecate } from '@ember/debug' ;
2
- import { importSync , isTesting , dependencySatisfies } from '@embroider/macros ' ;
2
+ import require from 'require ' ;
3
3
import * as mirage from 'miragejs' ;
4
4
import * as ecMirageExports from './index' ;
5
5
@@ -15,8 +15,8 @@ export function initDeprecatedReExports() {
15
15
// eslint-disable-next-line no-import-assign
16
16
Object . defineProperty ( ecMirageExports , name , {
17
17
get ( ) {
18
- if ( isTesting ( ) && dependencySatisfies ( 'ember-qunit' , '* ') ) {
19
- const { waitUntil, getContext } = importSync ( '@ember/test-helpers' ) ;
18
+ if ( require . has ( 'ember-qunit' ) ) {
19
+ const { waitUntil, getContext } = require ( '@ember/test-helpers' ) ;
20
20
21
21
window . QUnit . begin ( function ( ) {
22
22
// Make sure deprecation message does not get "swallowed"
Original file line number Diff line number Diff line change 1
- import { importSync , dependencySatisfies , isTesting } from '@embroider/macros ' ;
1
+ import require from 'require ' ;
2
2
3
3
/**
4
4
Helper to get our rfc232/rfc268 test context object, or null if we're not in
@@ -10,8 +10,8 @@ export default function getRfc232TestContext() {
10
10
// Support older versions of `ember-qunit` that don't have
11
11
// `@ember/test-helpers` (and therefore cannot possibly be running an
12
12
// rfc232/rfc268 test).
13
- if ( dependencySatisfies ( '@ember/test-helpers' , '*' ) && isTesting ( ) ) {
14
- let { getContext } = importSync ( '@ember/test-helpers' ) ;
13
+ if ( require . has ( '@ember/test-helpers' ) ) {
14
+ let { getContext } = require ( '@ember/test-helpers' ) ;
15
15
return getContext ( ) ;
16
16
}
17
17
}
Original file line number Diff line number Diff line change 1
- import { dependencySatisfies } from '@embroider/macros' ;
1
+ /* global requirejs */
2
+
3
+ function _hasEmberData ( ) {
4
+ let matchRegex1 = / ^ e m b e r - d a t a / i;
5
+ let matchRegex2 = / ^ @ e m b e r - d a t a / i;
6
+
7
+ return ! ! Object . keys ( requirejs . entries ) . find (
8
+ ( e ) => ! ! e . match ( matchRegex2 ) || ! ! e . match ( matchRegex1 )
9
+ ) ;
10
+ }
2
11
3
12
/**
4
13
@hide
5
14
*/
6
- export const hasEmberData = dependencySatisfies ( 'ember-data' , '*' ) ;
15
+ export const hasEmberData = _hasEmberData ( ) ;
7
16
8
17
/**
9
18
@hide
Original file line number Diff line number Diff line change 40
40
"prepare" : " ./scripts/link.sh"
41
41
},
42
42
"dependencies" : {
43
- "@embroider/macros" : " ^0.41.0" ,
44
43
"broccoli-file-creator" : " ^2.1.1" ,
45
44
"broccoli-funnel" : " ^3.0.3" ,
46
45
"broccoli-merge-trees" : " ^4.2.0" ,
52
51
"lodash-es" : " ^4.17.11" ,
53
52
"miragejs" : " ^0.1.43"
54
53
},
55
- "peerDependencies" : {
56
- "@ember/test-helpers" : " *" ,
57
- "ember-data" : " *" ,
58
- "ember-qunit" : " *"
59
- },
60
- "peerDependenciesMeta" : {
61
- "@ember/test-helpers" : {
62
- "optional" : true
63
- },
64
- "ember-data" : {
65
- "optional" : true
66
- },
67
- "ember-qunit" : {
68
- "optional" : true
69
- }
70
- },
71
54
"devDependencies" : {
72
55
"@ember/jquery" : " ^2.0.0" ,
73
56
"@ember/optional-features" : " ^2.0.0" ,
74
57
"@ember/test-helpers" : " ^2.6.0" ,
58
+ "@embroider/macros" : " ^0.41.0" ,
75
59
"@embroider/test-setup" : " ^0.41.0" ,
76
60
"@glimmer/component" : " ^1.0.4" ,
77
61
"@glimmer/tracking" : " ^1.0.4" ,
You can’t perform that action at this time.
0 commit comments