File tree 10 files changed +1011
-778
lines changed
10 files changed +1011
-778
lines changed Original file line number Diff line number Diff line change 55
55
- env : EMBER_TRY_SCENARIO=ember-canary
56
56
- env : EMBER_TRY_SCENARIO=ember-default-with-jquery
57
57
- env : EMBER_TRY_SCENARIO=ember-classic
58
+ - env : EMBER_TRY_SCENARIO=embroider
59
+ - env : EMBER_TRY_SCENARIO=embroider TEST_FRAMEWORK=ember-mocha
60
+ - env : EMBER_TRY_SCENARIO=embroider-optimized
61
+ - env : EMBER_TRY_SCENARIO=embroider-optimized TEST_FRAMEWORK=ember-mocha
58
62
59
63
before_install :
60
64
- curl -o- -L https://yarnpkg.com/install.sh | bash
Original file line number Diff line number Diff line change 1
- /* globals require, requirejs */
1
+ import { dependencySatisfies , macroCondition , importSync } from '@embroider/macros' ;
2
2
3
3
/**
4
4
* Returns ember-exam-qunit-test-loader or ember-exam-mocha-test-loader
8
8
* @return {Object }
9
9
*/
10
10
export default function getTestLoader ( ) {
11
- if ( requirejs . entries [ 'ember-qunit/test-loader' ] ) {
12
- const EmberExamQUnitTestLoader = require ( './ember-exam-qunit-test-loader' ) ;
11
+ if ( macroCondition ( dependencySatisfies ( 'ember-qunit' , '*' ) ) ) {
12
+ const EmberExamQUnitTestLoader = importSync ( './ember-exam-qunit-test-loader' ) ;
13
13
return EmberExamQUnitTestLoader [ 'default' ] ;
14
- } else if ( requirejs . entries [ 'ember-mocha/test-loader' ] ) {
15
- const EmberExamMochaTestLoader = require ( './ember-exam-mocha-test-loader' ) ;
14
+ } else if ( macroCondition ( dependencySatisfies ( 'ember-mocha' , '*' ) ) ) {
15
+ const EmberExamMochaTestLoader = importSync ( './ember-exam-mocha-test-loader' ) ;
16
16
return EmberExamMochaTestLoader [ 'default' ] ;
17
17
}
18
18
Original file line number Diff line number Diff line change 1
- /* globals require */
2
-
3
1
import loadEmberExam from 'ember-exam/test-support/load' ;
2
+ import { dependencySatisfies , macroCondition , importSync } from '@embroider/macros' ;
4
3
5
4
/**
6
5
* Equivalent to ember-qunit or ember-mocha's loadTest() except this does not create a new TestLoader instance
@@ -26,14 +25,18 @@ function loadTests(testLoader) {
26
25
* @param {* } qunitOptions
27
26
*/
28
27
export default function start ( qunitOptions ) {
29
- const framework = require . has ( 'ember-qunit' ) ? 'qunit' : 'mocha' ;
30
28
const modifiedOptions = qunitOptions || Object . create ( null ) ;
31
29
modifiedOptions . loadTests = false ;
32
30
33
31
const testLoader = loadEmberExam ( ) ;
34
32
loadTests ( testLoader ) ;
35
33
36
- const emberTestFramework = require ( `ember-${ framework } ` ) ;
34
+ let emberTestFramework ;
35
+ if ( macroCondition ( dependencySatisfies ( 'ember-qunit' , '*' ) ) ) {
36
+ emberTestFramework = importSync ( 'ember-qunit' ) ;
37
+ } else if ( macroCondition ( dependencySatisfies ( 'ember-mocha' , '*' ) ) ) {
38
+ emberTestFramework = importSync ( 'ember-mocha' ) ;
39
+ }
37
40
38
41
if ( emberTestFramework . start ) {
39
42
emberTestFramework . start ( modifiedOptions ) ;
Original file line number Diff line number Diff line change @@ -85,6 +85,26 @@ module.exports = async function() {
85
85
edition : 'classic'
86
86
}
87
87
}
88
+ } ,
89
+ {
90
+ name : 'embroider' ,
91
+ npm : {
92
+ devDependencies : {
93
+ '@embroider/core' : '*' ,
94
+ '@embroider/webpack' : '*' ,
95
+ '@embroider/compat' : '*' ,
96
+ } ,
97
+ } ,
98
+ } ,
99
+ {
100
+ name : 'embroider-optimized' ,
101
+ npm : {
102
+ devDependencies : {
103
+ '@embroider/core' : '*' ,
104
+ '@embroider/webpack' : '*' ,
105
+ '@embroider/compat' : '*' ,
106
+ } ,
107
+ }
88
108
}
89
109
]
90
110
} ;
Original file line number Diff line number Diff line change @@ -14,5 +14,23 @@ module.exports = function(defaults) {
14
14
behave. You most likely want to be modifying `./index.js` or app's build file
15
15
*/
16
16
17
- return app . toTree ( ) ;
17
+ // Use embroider if it's present (it can get added by ember-try)
18
+ if ( '@embroider/core' in app . dependencies ( ) ) {
19
+ /* eslint-disable node/no-missing-require, node/no-extraneous-require */
20
+ const { Webpack } = require ( '@embroider/webpack' ) ;
21
+ const { compatBuild } = require ( '@embroider/compat' ) ;
22
+ /* eslint-enable node/no-missing-require, node/no-extraneous-require */
23
+ let config = { } ;
24
+ if ( process . env . EMBER_TRY_SCENARIO === 'embroider-optimized' ) {
25
+ config = {
26
+ staticAddonTrees : true ,
27
+ staticAddonTestSupportTrees : true ,
28
+ staticHelpers : true ,
29
+ staticComponents : true ,
30
+ }
31
+ }
32
+ return compatBuild ( app , Webpack , config ) ;
33
+ } else {
34
+ return app . toTree ( ) ;
35
+ }
18
36
} ;
Original file line number Diff line number Diff line change 29
29
"test:node" : " nyc mocha 'node-tests/**/*-test.js'"
30
30
},
31
31
"dependencies" : {
32
+ "@embroider/macros" : " ^0.26.0" ,
32
33
"chalk" : " ^4.1.0" ,
33
34
"cli-table3" : " ^0.6.0" ,
34
35
"debug" : " ^4.1.0" ,
46
47
"babel-eslint" : " ^10.1.0" ,
47
48
"codeclimate-test-reporter" : " ^0.5.0" ,
48
49
"ember-cli" : " ^3.21.2" ,
49
- "ember-cli-addon-docs" : " ^0.6.15 " ,
50
+ "ember-cli-addon-docs" : " ^0.10.0 " ,
50
51
"ember-cli-addon-docs-yuidoc" : " ^0.2.4" ,
51
52
"ember-cli-dependency-checker" : " ^3.0.0" ,
52
53
"ember-cli-deploy" : " ^1.0.2" ,
80
81
"sinon" : " ^9.0.3" ,
81
82
"testdouble" : " ^3.16.1"
82
83
},
84
+ "peerDependencies" : {
85
+ "ember-mocha" : " *" ,
86
+ "ember-qunit" : " *"
87
+ },
88
+ "peerDependenciesMeta" : {
89
+ "ember-qunit" : {
90
+ "optional" : true
91
+ },
92
+ "ember-mocha" : {
93
+ "optional" : true
94
+ }
95
+ },
83
96
"engines" : {
84
97
"node" : " 10.* || >= 12"
85
98
},
Original file line number Diff line number Diff line change 3
3
import { setResolver } from '@ember/test-helpers' ;
4
4
import resolver from './helpers/resolver' ;
5
5
import start from 'ember-exam/test-support/start' ;
6
+ import { macroCondition , dependencySatisfies } from '@embroider/macros' ;
6
7
7
- const oppositeFramework = ! require . has ( 'ember-qunit' ) ? 'qunit' : 'mocha ' ;
8
+ const oppositeFramework = macroCondition ( dependencySatisfies ( 'ember-qunit' , '*' ) ) ? 'mocha' : 'qunit ' ;
8
9
9
10
Object . keys ( require . entries ) . forEach ( ( entry ) => {
10
11
if ( entry . indexOf ( oppositeFramework ) !== - 1 ) {
Original file line number Diff line number Diff line change 1
1
import { describe , it } from 'mocha' ;
2
2
import { expect } from 'chai' ;
3
- import TestemOutput from 'ember-exam/test-support/-private/patch-testem-output' ;
3
+ import * as TestemOutput from 'ember-exam/test-support/-private/patch-testem-output' ;
4
4
5
5
describe ( 'Unit | Mocha | patch-testem-output' , ( ) => {
6
6
it ( 'add partition number to test name when `split` is passed' , function ( ) {
Original file line number Diff line number Diff line change 1
1
import { module , test } from 'qunit' ;
2
- import TestemOutput from 'ember-exam/test-support/-private/patch-testem-output' ;
2
+ import * as TestemOutput from 'ember-exam/test-support/-private/patch-testem-output' ;
3
3
4
4
module ( 'Unit | Qunit | patch-testem-output' , ( ) => {
5
5
test ( 'add partition number to test name when `split` is passed' , function ( assert ) {
You can’t perform that action at this time.
0 commit comments