File tree Expand file tree Collapse file tree 1 file changed +63
-0
lines changed
Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -152,3 +152,66 @@ describe('fis3-packager-smart pack', function() {
152152 } ) ;
153153 } ) ;
154154} ) ;
155+
156+
157+ // 所有js打包成一个文件
158+ describe ( 'fis3-packager-smart pack - jsAllInOne' , function ( ) {
159+
160+ var dist = path . join ( __dirname , 'allInOne' ) ;
161+ beforeEach ( function ( ) {
162+
163+
164+ _ . del ( dist ) ;
165+
166+ _self . options = {
167+ autoPack : true ,
168+ cssInline : true ,
169+ jsAllInOne : true
170+ } ;
171+
172+ fis . match ( '::package' , {
173+ packager : _self
174+ } ) ;
175+
176+ fis . match ( '*' , {
177+ deploy : fis . plugin ( 'local-deliver' , {
178+ to : dist
179+ } )
180+ } ) ;
181+
182+ fis . hook ( 'commonjs' ) ;
183+
184+
185+ fis . match ( / ^ \/ m o d u l e s \/ ( .+ ) \. j s $ / , {
186+ isMod : true ,
187+ id : '$1'
188+ } )
189+ . match ( / ^ \/ m o d u l e s \/ ( (?: [ ^ \/ ] + \/ ) * ) ( [ ^ \/ ] + ) \/ \2\. ( j s ) $ / i, {
190+ // isMod: true,
191+ id : '$1$2'
192+ } )
193+ . match ( / ^ \/ l e g o _ m o d u l e s \/ ( .+ ) \. j s $ / i, {
194+ isMod : true ,
195+ id : '$1'
196+ } ) ;
197+
198+ fis . match ( / ^ \/ ( p a g e s \/ .+ ) \. j s $ / , {
199+ isMod : true ,
200+ id : '$1'
201+ } ) ;
202+
203+ } ) ;
204+
205+ it ( 'lego hook' , function ( done ) {
206+
207+ release ( {
208+ unique : true
209+ } , function ( ) {
210+ expect ( fs . existsSync ( path . join ( dist , 'pkg/index.html_aio.js' ) ) ) . to . be . true ;
211+ var content = fs . readFileSync ( path . join ( dist , 'index.html' ) ) ;
212+ expect ( / < s c r i p t \s s r c = \" \/ p k g \/ i n d e x \. h t m l _ a i o \. j s \" > < \/ s c r i p t > / . test ( content ) ) . to . be . true ;
213+ done ( ) ;
214+ fis . log . info ( 'release complete' ) ;
215+ } ) ;
216+ } ) ;
217+ } ) ;
You can’t perform that action at this time.
0 commit comments