@@ -111,4 +111,59 @@ describe('utils', function() {
111
111
} ) ;
112
112
} ) ;
113
113
} ) ;
114
+
115
+ describe ( 'isInlinePrecompileBabelPluginRegistered' , function ( ) {
116
+ let nonParallelizablePlugin , parallelizablePlugin ;
117
+
118
+ beforeEach ( function ( ) {
119
+ let modules = {
120
+ 'ember-cli-htmlbars' : 'hbs' ,
121
+ 'ember-cli-htmlbars-inline-precompile' : 'default' ,
122
+ 'htmlbars-inline-precompile' : 'default' ,
123
+ } ;
124
+
125
+ nonParallelizablePlugin = [
126
+ require . resolve ( 'babel-plugin-htmlbars-inline-precompile' ) ,
127
+ { precompile : null , modules } ,
128
+ 'ember-cli-htmlbars:inline-precompile' ,
129
+ ] ;
130
+
131
+ parallelizablePlugin = {
132
+ baseDir : ( ) => __dirname ,
133
+ cacheKey : ( ) => `${ Date . now ( ) } ` ,
134
+ _parallelBabel : {
135
+ requireFile : require . resolve ( '../lib/require-from-worker' ) ,
136
+ buildUsing : 'build' ,
137
+ params : {
138
+ templateCompilerPath : null ,
139
+ parallelConfigs : [ ] ,
140
+ modules,
141
+ } ,
142
+ } ,
143
+ } ;
144
+ [
145
+ require . resolve ( 'babel-plugin-htmlbars-inline-precompile' ) ,
146
+ { precompile : null , modules } ,
147
+ 'ember-cli-htmlbars:inline-precompile' ,
148
+ ] ;
149
+ } ) ;
150
+
151
+ it ( 'is false when no plugins exist' , function ( ) {
152
+ let plugins = [ ] ;
153
+
154
+ assert . strictEqual ( utils . isInlinePrecompileBabelPluginRegistered ( plugins ) , false ) ;
155
+ } ) ;
156
+
157
+ it ( 'detects when the non-parallelizable version of the plugin has been installed' , function ( ) {
158
+ let plugins = [ nonParallelizablePlugin ] ;
159
+
160
+ assert . strictEqual ( utils . isInlinePrecompileBabelPluginRegistered ( plugins ) , true ) ;
161
+ } ) ;
162
+
163
+ it ( 'detects when the parallelizable version of the plugin has been installed' , function ( ) {
164
+ let plugins = [ parallelizablePlugin ] ;
165
+
166
+ assert . strictEqual ( utils . isInlinePrecompileBabelPluginRegistered ( plugins ) , true ) ;
167
+ } ) ;
168
+ } ) ;
114
169
} ) ;
0 commit comments