88 writeFile,
99} = require ( 'fs/promises' ) ;
1010const looksLike = require ( 'html-looks-like' ) ;
11- const { create, build, buildFast } = require ( './lib/cli' ) ;
11+ const { create, build } = require ( './lib/cli' ) ;
1212const { snapshot } = require ( './lib/utils' ) ;
1313const { subject } = require ( './lib/output' ) ;
1414const images = require ( './images/build' ) ;
@@ -80,25 +80,25 @@ describe('preact build', () => {
8080 it ( 'builds the `typescript` template' , async ( ) => {
8181 let dir = await create ( 'typescript' ) ;
8282
83- await expect ( buildFast ( dir ) ) . resolves . not . toThrow ( ) ;
83+ await expect ( build ( dir ) ) . resolves . not . toThrow ( ) ;
8484 } ) ;
8585
8686 it ( 'should patch global location object' , async ( ) => {
8787 let dir = await subject ( 'location-patch' ) ;
8888
89- await expect ( buildFast ( dir ) ) . resolves . not . toThrow ( ) ;
89+ await expect ( build ( dir ) ) . resolves . not . toThrow ( ) ;
9090 } ) ;
9191
9292 it ( 'should copy resources from static to build directory' , async ( ) => {
9393 let dir = await subject ( 'static-root' ) ;
94- await buildFast ( dir ) ;
94+ await build ( dir ) ;
9595 let file = join ( dir , 'build' , '.htaccess' ) ;
9696 expect ( await access ( file ) ) . toBeUndefined ( ) ;
9797 } ) ;
9898
9999 it ( 'should use a custom `.env` with prefixed environment variables' , async ( ) => {
100100 let dir = await subject ( 'custom-dotenv' ) ;
101- await buildFast ( dir ) ;
101+ await build ( dir ) ;
102102
103103 const bundleFile = ( await readdir ( `${ dir } /build` ) ) . find ( file =>
104104 / b u n d l e \. \w { 5 } \. j s $ / . test ( file )
@@ -131,15 +131,13 @@ describe('preact build', () => {
131131 await rename ( join ( dir , 'index.js' ) , join ( dir , 'renamed-src/index.js' ) ) ;
132132 await rename ( join ( dir , 'style.css' ) , join ( dir , 'renamed-src/style.css' ) ) ;
133133
134- await expect (
135- buildFast ( dir , { src : 'renamed-src' } )
136- ) . resolves . not . toThrow ( ) ;
134+ await expect ( build ( dir , { src : 'renamed-src' } ) ) . resolves . not . toThrow ( ) ;
137135 } ) ;
138136
139137 it ( '--dest' , async ( ) => {
140138 let dir = await subject ( 'minimal' ) ;
141139
142- await buildFast ( dir , { dest : 'renamed-dest' } ) ;
140+ await build ( dir , { dest : 'renamed-dest' } ) ;
143141 expect ( await access ( join ( dir , 'renamed-dest' ) ) ) . toBeUndefined ( ) ;
144142 } ) ;
145143
@@ -148,13 +146,13 @@ describe('preact build', () => {
148146
149147 const logSpy = jest . spyOn ( process . stdout , 'write' ) ;
150148
151- await buildFast ( dir , { sw : true } ) ;
149+ await build ( dir , { sw : true } ) ;
152150 expect ( await access ( join ( dir , 'build' , 'sw.js' ) ) ) . toBeUndefined ( ) ;
153151 expect ( logSpy ) . toHaveBeenCalledWith (
154152 expect . stringContaining ( 'Could not find sw.js' )
155153 ) ;
156154
157- await buildFast ( dir , { sw : false } ) ;
155+ await build ( dir , { sw : false } ) ;
158156 await expect ( access ( join ( dir , 'build' , 'sw.js' ) ) ) . rejects . toThrow (
159157 'no such file or directory'
160158 ) ;
@@ -165,12 +163,12 @@ describe('preact build', () => {
165163 // Prerendering is disabled to avoid (non-relevant) regenerator issues
166164 let dir = await subject ( 'custom-babelrc' ) ;
167165
168- await buildFast ( dir , { prerender : false } ) ;
166+ await build ( dir , { prerender : false } ) ;
169167 let transpiledChunk = await getOutputFile ( dir , / b u n d l e \. \w { 5 } \. j s $ / ) ;
170168 expect ( / = > \s ? s e t T i m e o u t / . test ( transpiledChunk ) ) . toBe ( false ) ;
171169
172170 await rename ( join ( dir , '.babelrc' ) , join ( dir , 'babel.config.json' ) ) ;
173- await buildFast ( dir , {
171+ await build ( dir , {
174172 babelConfig : 'babel.config.json' ,
175173 prerender : false ,
176174 } ) ;
@@ -185,7 +183,7 @@ describe('preact build', () => {
185183 join ( dir , 'template.ejs' ) ,
186184 join ( dir , 'renamed-template.ejs' )
187185 ) ;
188- await buildFast ( dir , { template : 'renamed-template.ejs' } ) ;
186+ await build ( dir , { template : 'renamed-template.ejs' } ) ;
189187
190188 const html = await getOutputFile ( dir , 'index.html' ) ;
191189 expect ( html ) . toEqual (
@@ -196,19 +194,19 @@ describe('preact build', () => {
196194 it ( '--prerender' , async ( ) => {
197195 let dir = await subject ( 'minimal' ) ;
198196
199- await buildFast ( dir , { prerender : true } ) ;
197+ await build ( dir , { prerender : true } ) ;
200198 let html = await getOutputFile ( dir , 'index.html' ) ;
201199 expect ( html ) . toMatch ( '<h1>Minimal App</h1>' ) ;
202200
203- await buildFast ( dir , { prerender : false } ) ;
201+ await build ( dir , { prerender : false } ) ;
204202 html = await getOutputFile ( dir , 'index.html' ) ;
205203 expect ( html ) . not . toMatch ( '<h1>Minimal App</h1>' ) ;
206204 } ) ;
207205
208206 it ( '--prerenderUrls' , async ( ) => {
209207 let dir = await subject ( 'multiple-prerendering' ) ;
210208
211- await buildFast ( dir , { prerenderUrls : 'prerender-urls.json' } ) ;
209+ await build ( dir , { prerenderUrls : 'prerender-urls.json' } ) ;
212210 expect ( await access ( join ( dir , 'build/index.html' ) ) ) . toBeUndefined ( ) ;
213211 expect (
214212 await access ( join ( dir , 'build/route66/index.html' ) )
@@ -221,7 +219,7 @@ describe('preact build', () => {
221219 join ( dir , 'prerender-urls.json' ) ,
222220 join ( dir , 'renamed-urls.json' )
223221 ) ;
224- await buildFast ( dir , { prerenderUrls : 'renamed-urls.json' } ) ;
222+ await build ( dir , { prerenderUrls : 'renamed-urls.json' } ) ;
225223 expect ( await access ( join ( dir , 'build/index.html' ) ) ) . toBeUndefined ( ) ;
226224 expect (
227225 await access ( join ( dir , 'build/route66/index.html' ) )
@@ -234,26 +232,26 @@ describe('preact build', () => {
234232 it ( '--inlineCss' , async ( ) => {
235233 let dir = await subject ( 'minimal' ) ;
236234
237- await buildFast ( dir , { inlineCss : true } ) ;
235+ await build ( dir , { inlineCss : true } ) ;
238236 let head = await getHead ( dir ) ;
239237 expect ( head ) . toMatch ( '<style>h1{color:red}</style>' ) ;
240238
241- await buildFast ( dir , { inlineCss : false } ) ;
239+ await build ( dir , { inlineCss : false } ) ;
242240 head = await getOutputFile ( dir , 'index.html' ) ;
243241 expect ( head ) . not . toMatch ( / < s t y l e > [ ^ < ] * < \/ s t y l e > / ) ;
244242 } ) ;
245243
246244 it ( '--config' , async ( ) => {
247245 let dir = await subject ( 'custom-webpack' ) ;
248246
249- await buildFast ( dir , { config : 'preact.config.js' } ) ;
247+ await build ( dir , { config : 'preact.config.js' } ) ;
250248 expect ( await access ( join ( dir , 'build/bundle.js' ) ) ) . toBeUndefined ( ) ;
251249
252250 await rename (
253251 join ( dir , 'preact.config.js' ) ,
254252 join ( dir , 'renamed-config.js' )
255253 ) ;
256- await buildFast ( dir , { config : 'renamed-config.js' } ) ;
254+ await build ( dir , { config : 'renamed-config.js' } ) ;
257255 expect ( await access ( join ( dir , 'build/bundle.js' ) ) ) . toBeUndefined ( ) ;
258256 } ) ;
259257
@@ -278,7 +276,7 @@ describe('preact build', () => {
278276 'h2{color:green}'
279277 ) ;
280278
281- await buildFast ( dir ) ;
279+ await build ( dir ) ;
282280 const builtStylesheet = await getOutputFile ( dir , / b u n d l e \. \w { 5 } \. c s s $ / ) ;
283281
284282 expect ( builtStylesheet ) . toMatch ( 'h1{color:red}' ) ;
@@ -289,7 +287,7 @@ describe('preact build', () => {
289287
290288 it ( 'should use plain CSS & CSS Modules together, determining loading method by filename' , async ( ) => {
291289 let dir = await subject ( 'css-modules' ) ;
292- await buildFast ( dir ) ;
290+ await build ( dir ) ;
293291 const builtStylesheet = await getOutputFile ( dir , / b u n d l e \. \w { 5 } \. c s s $ / ) ;
294292
295293 expect ( builtStylesheet ) . toMatch ( 'h1{color:red}' ) ;
@@ -298,7 +296,7 @@ describe('preact build', () => {
298296
299297 it ( 'should inline critical CSS only' , async ( ) => {
300298 let dir = await subject ( 'css-inline' ) ;
301- await buildFast ( dir ) ;
299+ await build ( dir ) ;
302300 const builtStylesheet = await getOutputFile ( dir , / b u n d l e \. \w { 5 } \. c s s $ / ) ;
303301 const html = await getOutputFile ( dir , 'index.html' ) ;
304302
@@ -309,15 +307,15 @@ describe('preact build', () => {
309307 // Issue #1411
310308 it ( 'should preserve side-effectful CSS imports even if package.json claims no side effects' , async ( ) => {
311309 let dir = await subject ( 'css-side-effect' ) ;
312- await buildFast ( dir ) ;
310+ await build ( dir ) ;
313311
314312 const builtStylesheet = await getOutputFile ( dir , / b u n d l e \. \w { 5 } \. c s s $ / ) ;
315313 expect ( builtStylesheet ) . toMatch ( 'h1{background:#673ab8}' ) ;
316314 } ) ;
317315
318316 it ( 'should use SASS, SCSS, and CSS Modules for each' , async ( ) => {
319317 let dir = await subject ( 'css-sass' ) ;
320- await buildFast ( dir ) ;
318+ await build ( dir ) ;
321319 const builtStylesheet = await getOutputFile ( dir , / b u n d l e \. \w { 5 } \. c s s $ / ) ;
322320
323321 expect ( builtStylesheet ) . toMatch ( 'h1{background:blue;color:red}' ) ;
@@ -330,7 +328,7 @@ describe('preact build', () => {
330328 prerenderUrlFiles . forEach ( prerenderUrls => {
331329 it ( `should prerender the routes provided with '${ prerenderUrls } '` , async ( ) => {
332330 let dir = await subject ( 'multiple-prerendering' ) ;
333- await buildFast ( dir , { prerenderUrls } ) ;
331+ await build ( dir , { prerenderUrls } ) ;
334332
335333 const body1 = await getBody ( dir ) ;
336334 looksLike ( body1 , images . prerender . home ) ;
@@ -367,7 +365,7 @@ describe('preact build', () => {
367365 prerenderUrlFiles . forEach ( prerenderUrls => {
368366 it ( `should prerender the routes with data provided with '${ prerenderUrls } ' via provider` , async ( ) => {
369367 let dir = await subject ( 'multiple-prerendering-with-provider' ) ;
370- await buildFast ( dir , { prerenderUrls } ) ;
368+ await build ( dir , { prerenderUrls } ) ;
371369
372370 const body1 = await getBody ( dir ) ;
373371 looksLike ( body1 , images . prerender . home ) ;
0 commit comments