@@ -32,8 +32,8 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
32
32
await harness . writeFile ( 'src/server.ts' , `console.log('Hello!');` ) ;
33
33
} ) ;
34
34
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 ( ) => {
37
37
harness . useTarget ( 'build' , {
38
38
...BASE_OPTIONS ,
39
39
polyfills : [ ] ,
@@ -44,34 +44,20 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
44
44
entry : 'src/server.ts' ,
45
45
} ,
46
46
} ) ;
47
- } ) ;
48
47
49
- it ( `should emit browser bundles in 'browser' directory` , async ( ) => {
50
48
const { result } = await harness . executeOnce ( ) ;
51
49
expect ( result ?. success ) . toBeTrue ( ) ;
52
50
53
51
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
-
60
52
harness . expectFile ( 'dist/browser/media/spectrum.png' ) . toExist ( ) ;
61
53
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
-
68
54
harness . expectFile ( 'dist/server/server.mjs' ) . toExist ( ) ;
69
55
} ) ;
70
56
} ) ;
71
57
72
- describe ( ` when option value is an object` , ( ) => {
58
+ describe ( ' when option value is an object' , ( ) => {
73
59
describe ( `'media' is set to 'resources'` , ( ) => {
74
- beforeEach ( ( ) => {
60
+ it ( 'should emit browser, media and server files in their respective directories' , async ( ) => {
75
61
harness . useTarget ( 'build' , {
76
62
...BASE_OPTIONS ,
77
63
polyfills : [ ] ,
@@ -85,33 +71,19 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
85
71
entry : 'src/server.ts' ,
86
72
} ,
87
73
} ) ;
88
- } ) ;
89
74
90
- it ( `should emit browser bundles in 'browser' directory` , async ( ) => {
91
75
const { result } = await harness . executeOnce ( ) ;
92
76
expect ( result ?. success ) . toBeTrue ( ) ;
93
77
94
78
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
-
101
79
harness . expectFile ( 'dist/browser/resource/spectrum.png' ) . toExist ( ) ;
102
80
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
-
109
81
harness . expectFile ( 'dist/server/server.mjs' ) . toExist ( ) ;
110
82
} ) ;
111
83
} ) ;
112
84
113
85
describe ( `'media' is set to ''` , ( ) => {
114
- beforeEach ( ( ) => {
86
+ it ( 'should emit browser, media and server files in their respective directories' , async ( ) => {
115
87
harness . useTarget ( 'build' , {
116
88
...BASE_OPTIONS ,
117
89
polyfills : [ ] ,
@@ -125,36 +97,20 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
125
97
entry : 'src/server.ts' ,
126
98
} ,
127
99
} ) ;
128
- } ) ;
129
100
130
- it ( `should emit browser bundles in 'browser' directory` , async ( ) => {
131
101
const { result } = await harness . executeOnce ( ) ;
132
102
expect ( result ?. success ) . toBeTrue ( ) ;
133
103
134
104
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
-
141
105
harness . expectFile ( 'dist/browser/spectrum.png' ) . toExist ( ) ;
142
106
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
-
152
107
harness . expectFile ( 'dist/server/server.mjs' ) . toExist ( ) ;
108
+ harness . expectFile ( 'dist/browser/app.component.css' ) . toNotExist ( ) ;
153
109
} ) ;
154
110
} ) ;
155
111
156
112
describe ( `'server' is set to 'node-server'` , ( ) => {
157
- beforeEach ( ( ) => {
113
+ it ( 'should emit browser, media and server files in their respective directories' , async ( ) => {
158
114
harness . useTarget ( 'build' , {
159
115
...BASE_OPTIONS ,
160
116
polyfills : [ ] ,
@@ -168,33 +124,19 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
168
124
entry : 'src/server.ts' ,
169
125
} ,
170
126
} ) ;
171
- } ) ;
172
127
173
- it ( `should emit browser bundles in 'browser' directory` , async ( ) => {
174
128
const { result } = await harness . executeOnce ( ) ;
175
129
expect ( result ?. success ) . toBeTrue ( ) ;
176
130
177
131
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
-
184
132
harness . expectFile ( 'dist/browser/media/spectrum.png' ) . toExist ( ) ;
185
133
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
-
192
134
harness . expectFile ( 'dist/node-server/server.mjs' ) . toExist ( ) ;
193
135
} ) ;
194
136
} ) ;
195
137
196
138
describe ( `'browser' is set to 'public'` , ( ) => {
197
- beforeEach ( ( ) => {
139
+ it ( 'should emit browser, media and server files in their respective directories' , async ( ) => {
198
140
harness . useTarget ( 'build' , {
199
141
...BASE_OPTIONS ,
200
142
polyfills : [ ] ,
@@ -208,51 +150,19 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
208
150
entry : 'src/server.ts' ,
209
151
} ,
210
152
} ) ;
211
- } ) ;
212
153
213
- it ( `should emit browser bundles in 'public' directory` , async ( ) => {
214
154
const { result } = await harness . executeOnce ( ) ;
215
155
expect ( result ?. success ) . toBeTrue ( ) ;
216
156
217
157
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
-
224
158
harness . expectFile ( 'dist/public/media/spectrum.png' ) . toExist ( ) ;
225
159
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
-
232
160
harness . expectFile ( 'dist/server/server.mjs' ) . toExist ( ) ;
233
161
} ) ;
234
162
} ) ;
235
163
236
164
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 ( ) => {
256
166
harness . useTarget ( 'build' , {
257
167
...BASE_OPTIONS ,
258
168
polyfills : [ ] ,
@@ -268,11 +178,12 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
268
178
const { result } = await harness . executeOnce ( ) ;
269
179
expect ( result ?. success ) . toBeTrue ( ) ;
270
180
181
+ harness . expectFile ( 'dist/main.js' ) . toExist ( ) ;
271
182
harness . expectFile ( 'dist/media/spectrum.png' ) . toExist ( ) ;
272
183
harness . expectFile ( 'dist/media/abc.svg' ) . toExist ( ) ;
273
184
} ) ;
274
185
275
- it ( ` should error when ssr is enabled` , async ( ) => {
186
+ it ( ' should error when ssr is enabled' , async ( ) => {
276
187
harness . useTarget ( 'build' , {
277
188
...BASE_OPTIONS ,
278
189
polyfills : [ ] ,
@@ -298,8 +209,8 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
298
209
} ) ;
299
210
} ) ;
300
211
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 ( ) => {
303
214
harness . useTarget ( 'build' , {
304
215
...BASE_OPTIONS ,
305
216
polyfills : [ ] ,
@@ -313,27 +224,13 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
313
224
entry : 'src/server.ts' ,
314
225
} ,
315
226
} ) ;
316
- } ) ;
317
227
318
- it ( `should emit browser bundles in 'browser' directory` , async ( ) => {
319
228
const { result } = await harness . executeOnce ( ) ;
320
229
expect ( result ?. success ) . toBeTrue ( ) ;
321
230
322
231
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
-
329
232
harness . expectFile ( 'dist/browser/media/spectrum.png' ) . toExist ( ) ;
330
233
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
-
337
234
harness . expectFile ( 'dist/server.mjs' ) . toExist ( ) ;
338
235
} ) ;
339
236
} ) ;
0 commit comments