@@ -32,8 +32,8 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
3232 await harness . writeFile ( 'src/server.ts' , `console.log('Hello!');` ) ;
3333 } ) ;
3434
35- describe ( ` when option value is is a string` , ( ) => {
36- beforeEach ( ( ) => {
35+ describe ( ' when option value is a string' , ( ) => {
36+ it ( 'should emit browser, media and server files in their respective directories' , async ( ) => {
3737 harness . useTarget ( 'build' , {
3838 ...BASE_OPTIONS ,
3939 polyfills : [ ] ,
@@ -44,34 +44,20 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
4444 entry : 'src/server.ts' ,
4545 } ,
4646 } ) ;
47- } ) ;
4847
49- it ( `should emit browser bundles in 'browser' directory` , async ( ) => {
5048 const { result } = await harness . executeOnce ( ) ;
5149 expect ( result ?. success ) . toBeTrue ( ) ;
5250
5351 harness . expectFile ( 'dist/browser/main.js' ) . toExist ( ) ;
54- } ) ;
55-
56- it ( `should emit media files in 'browser/media' directory` , async ( ) => {
57- const { result } = await harness . executeOnce ( ) ;
58- expect ( result ?. success ) . toBeTrue ( ) ;
59-
6052 harness . expectFile ( 'dist/browser/media/spectrum.png' ) . toExist ( ) ;
6153 harness . expectFile ( 'dist/browser/media/abc.svg' ) . toExist ( ) ;
62- } ) ;
63-
64- it ( `should emit server bundles in 'server' directory` , async ( ) => {
65- const { result } = await harness . executeOnce ( ) ;
66- expect ( result ?. success ) . toBeTrue ( ) ;
67-
6854 harness . expectFile ( 'dist/server/server.mjs' ) . toExist ( ) ;
6955 } ) ;
7056 } ) ;
7157
72- describe ( ` when option value is an object` , ( ) => {
58+ describe ( ' when option value is an object' , ( ) => {
7359 describe ( `'media' is set to 'resources'` , ( ) => {
74- beforeEach ( ( ) => {
60+ it ( 'should emit browser, media and server files in their respective directories' , async ( ) => {
7561 harness . useTarget ( 'build' , {
7662 ...BASE_OPTIONS ,
7763 polyfills : [ ] ,
@@ -85,33 +71,19 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
8571 entry : 'src/server.ts' ,
8672 } ,
8773 } ) ;
88- } ) ;
8974
90- it ( `should emit browser bundles in 'browser' directory` , async ( ) => {
9175 const { result } = await harness . executeOnce ( ) ;
9276 expect ( result ?. success ) . toBeTrue ( ) ;
9377
9478 harness . expectFile ( 'dist/browser/main.js' ) . toExist ( ) ;
95- } ) ;
96-
97- it ( `should emit media files in 'browser/resource' directory` , async ( ) => {
98- const { result } = await harness . executeOnce ( ) ;
99- expect ( result ?. success ) . toBeTrue ( ) ;
100-
10179 harness . expectFile ( 'dist/browser/resource/spectrum.png' ) . toExist ( ) ;
10280 harness . expectFile ( 'dist/browser/resource/abc.svg' ) . toExist ( ) ;
103- } ) ;
104-
105- it ( `should emit server bundles in 'server' directory` , async ( ) => {
106- const { result } = await harness . executeOnce ( ) ;
107- expect ( result ?. success ) . toBeTrue ( ) ;
108-
10981 harness . expectFile ( 'dist/server/server.mjs' ) . toExist ( ) ;
11082 } ) ;
11183 } ) ;
11284
11385 describe ( `'media' is set to ''` , ( ) => {
114- beforeEach ( ( ) => {
86+ it ( 'should emit browser, media and server files in their respective directories' , async ( ) => {
11587 harness . useTarget ( 'build' , {
11688 ...BASE_OPTIONS ,
11789 polyfills : [ ] ,
@@ -125,36 +97,20 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
12597 entry : 'src/server.ts' ,
12698 } ,
12799 } ) ;
128- } ) ;
129100
130- it ( `should emit browser bundles in 'browser' directory` , async ( ) => {
131101 const { result } = await harness . executeOnce ( ) ;
132102 expect ( result ?. success ) . toBeTrue ( ) ;
133103
134104 harness . expectFile ( 'dist/browser/main.js' ) . toExist ( ) ;
135- } ) ;
136-
137- it ( `should emit media files in 'browser' directory` , async ( ) => {
138- const { result } = await harness . executeOnce ( ) ;
139- expect ( result ?. success ) . toBeTrue ( ) ;
140-
141105 harness . expectFile ( 'dist/browser/spectrum.png' ) . toExist ( ) ;
142106 harness . expectFile ( 'dist/browser/abc.svg' ) . toExist ( ) ;
143-
144- // Component CSS should not be considered media
145- harness . expectFile ( 'dist/browser/app.component.css' ) . toNotExist ( ) ;
146- } ) ;
147-
148- it ( `should emit server bundles in 'server' directory` , async ( ) => {
149- const { result } = await harness . executeOnce ( ) ;
150- expect ( result ?. success ) . toBeTrue ( ) ;
151-
152107 harness . expectFile ( 'dist/server/server.mjs' ) . toExist ( ) ;
108+ harness . expectFile ( 'dist/browser/app.component.css' ) . toNotExist ( ) ;
153109 } ) ;
154110 } ) ;
155111
156112 describe ( `'server' is set to 'node-server'` , ( ) => {
157- beforeEach ( ( ) => {
113+ it ( 'should emit browser, media and server files in their respective directories' , async ( ) => {
158114 harness . useTarget ( 'build' , {
159115 ...BASE_OPTIONS ,
160116 polyfills : [ ] ,
@@ -168,33 +124,19 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
168124 entry : 'src/server.ts' ,
169125 } ,
170126 } ) ;
171- } ) ;
172127
173- it ( `should emit browser bundles in 'browser' directory` , async ( ) => {
174128 const { result } = await harness . executeOnce ( ) ;
175129 expect ( result ?. success ) . toBeTrue ( ) ;
176130
177131 harness . expectFile ( 'dist/browser/main.js' ) . toExist ( ) ;
178- } ) ;
179-
180- it ( `should emit media files in 'browser/media' directory` , async ( ) => {
181- const { result } = await harness . executeOnce ( ) ;
182- expect ( result ?. success ) . toBeTrue ( ) ;
183-
184132 harness . expectFile ( 'dist/browser/media/spectrum.png' ) . toExist ( ) ;
185133 harness . expectFile ( 'dist/browser/media/abc.svg' ) . toExist ( ) ;
186- } ) ;
187-
188- it ( `should emit server bundles in 'node-server' directory` , async ( ) => {
189- const { result } = await harness . executeOnce ( ) ;
190- expect ( result ?. success ) . toBeTrue ( ) ;
191-
192134 harness . expectFile ( 'dist/node-server/server.mjs' ) . toExist ( ) ;
193135 } ) ;
194136 } ) ;
195137
196138 describe ( `'browser' is set to 'public'` , ( ) => {
197- beforeEach ( ( ) => {
139+ it ( 'should emit browser, media and server files in their respective directories' , async ( ) => {
198140 harness . useTarget ( 'build' , {
199141 ...BASE_OPTIONS ,
200142 polyfills : [ ] ,
@@ -208,51 +150,19 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
208150 entry : 'src/server.ts' ,
209151 } ,
210152 } ) ;
211- } ) ;
212153
213- it ( `should emit browser bundles in 'public' directory` , async ( ) => {
214154 const { result } = await harness . executeOnce ( ) ;
215155 expect ( result ?. success ) . toBeTrue ( ) ;
216156
217157 harness . expectFile ( 'dist/public/main.js' ) . toExist ( ) ;
218- } ) ;
219-
220- it ( `should emit media files in 'public/media' directory` , async ( ) => {
221- const { result } = await harness . executeOnce ( ) ;
222- expect ( result ?. success ) . toBeTrue ( ) ;
223-
224158 harness . expectFile ( 'dist/public/media/spectrum.png' ) . toExist ( ) ;
225159 harness . expectFile ( 'dist/public/media/abc.svg' ) . toExist ( ) ;
226- } ) ;
227-
228- it ( `should emit server bundles in 'server' directory` , async ( ) => {
229- const { result } = await harness . executeOnce ( ) ;
230- expect ( result ?. success ) . toBeTrue ( ) ;
231-
232160 harness . expectFile ( 'dist/server/server.mjs' ) . toExist ( ) ;
233161 } ) ;
234162 } ) ;
235163
236164 describe ( `'browser' is set to ''` , ( ) => {
237- it ( `should emit browser bundles in '' directory` , async ( ) => {
238- harness . useTarget ( 'build' , {
239- ...BASE_OPTIONS ,
240- polyfills : [ ] ,
241- server : 'src/main.server.ts' ,
242- outputPath : {
243- base : 'dist' ,
244- browser : '' ,
245- } ,
246- ssr : false ,
247- } ) ;
248-
249- const { result } = await harness . executeOnce ( ) ;
250- expect ( result ?. success ) . toBeTrue ( ) ;
251-
252- harness . expectFile ( 'dist/main.js' ) . toExist ( ) ;
253- } ) ;
254-
255- it ( `should emit media files in 'media' directory` , async ( ) => {
165+ it ( 'should emit browser and media files in the root output directory when ssr is disabled' , async ( ) => {
256166 harness . useTarget ( 'build' , {
257167 ...BASE_OPTIONS ,
258168 polyfills : [ ] ,
@@ -268,11 +178,12 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
268178 const { result } = await harness . executeOnce ( ) ;
269179 expect ( result ?. success ) . toBeTrue ( ) ;
270180
181+ harness . expectFile ( 'dist/main.js' ) . toExist ( ) ;
271182 harness . expectFile ( 'dist/media/spectrum.png' ) . toExist ( ) ;
272183 harness . expectFile ( 'dist/media/abc.svg' ) . toExist ( ) ;
273184 } ) ;
274185
275- it ( ` should error when ssr is enabled` , async ( ) => {
186+ it ( ' should error when ssr is enabled' , async ( ) => {
276187 harness . useTarget ( 'build' , {
277188 ...BASE_OPTIONS ,
278189 polyfills : [ ] ,
@@ -298,8 +209,8 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
298209 } ) ;
299210 } ) ;
300211
301- describe ( `'server' is set ''` , ( ) => {
302- beforeEach ( ( ) => {
212+ describe ( `'server' is set to ''` , ( ) => {
213+ it ( 'should emit browser, media and server files in their respective directories' , async ( ) => {
303214 harness . useTarget ( 'build' , {
304215 ...BASE_OPTIONS ,
305216 polyfills : [ ] ,
@@ -313,27 +224,13 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
313224 entry : 'src/server.ts' ,
314225 } ,
315226 } ) ;
316- } ) ;
317227
318- it ( `should emit browser bundles in 'browser' directory` , async ( ) => {
319228 const { result } = await harness . executeOnce ( ) ;
320229 expect ( result ?. success ) . toBeTrue ( ) ;
321230
322231 harness . expectFile ( 'dist/browser/main.js' ) . toExist ( ) ;
323- } ) ;
324-
325- it ( `should emit media files in 'browser/media' directory` , async ( ) => {
326- const { result } = await harness . executeOnce ( ) ;
327- expect ( result ?. success ) . toBeTrue ( ) ;
328-
329232 harness . expectFile ( 'dist/browser/media/spectrum.png' ) . toExist ( ) ;
330233 harness . expectFile ( 'dist/browser/media/abc.svg' ) . toExist ( ) ;
331- } ) ;
332-
333- it ( `should emit server bundles in '' directory` , async ( ) => {
334- const { result } = await harness . executeOnce ( ) ;
335- expect ( result ?. success ) . toBeTrue ( ) ;
336-
337234 harness . expectFile ( 'dist/server.mjs' ) . toExist ( ) ;
338235 } ) ;
339236 } ) ;
0 commit comments