@@ -59,22 +59,24 @@ test('retrieve Nx specific dist and commands for a framework', async (ctx) => {
59
59
const project = new Project ( ctx . fs , fixture . cwd )
60
60
const settings = await project . getBuildSettings ( )
61
61
62
- expect ( settings ) . toEqual ( [
63
- expect . objectContaining ( {
64
- baseDirectory : '' , // nx needs to be run from the root
65
- buildCommand : 'nx run astro:build' ,
66
- devCommand : 'nx run astro:dev' ,
67
- dist : join ( 'dist/packages/astro' ) ,
68
- frameworkPort : 3000 ,
69
- } ) ,
70
- expect . objectContaining ( {
71
- baseDirectory : '' , // nx needs to be run from the root
72
- buildCommand : 'nx run website:build' ,
73
- devCommand : 'nx run website:serve' ,
74
- dist : join ( 'dist/packages/website/.next' ) ,
75
- frameworkPort : 4200 ,
76
- } ) ,
77
- ] )
62
+ expect ( settings ) . toEqual (
63
+ expect . arrayContaining ( [
64
+ expect . objectContaining ( {
65
+ baseDirectory : '' , // nx needs to be run from the root
66
+ buildCommand : 'nx run astro:build' ,
67
+ devCommand : 'nx run astro:dev' ,
68
+ dist : join ( 'dist/packages/astro' ) ,
69
+ frameworkPort : 3000 ,
70
+ } ) ,
71
+ expect . objectContaining ( {
72
+ baseDirectory : '' , // nx needs to be run from the root
73
+ buildCommand : 'nx run website:build' ,
74
+ devCommand : 'nx run website:serve' ,
75
+ dist : join ( 'dist/packages/website/.next' ) ,
76
+ frameworkPort : 4200 ,
77
+ } ) ,
78
+ ] ) ,
79
+ )
78
80
} )
79
81
80
82
test ( 'retrieve settings from the root for a base directory' , async ( ctx ) => {
@@ -128,22 +130,23 @@ test('get dev command from npm scripts if defined inside a workspace setup', asy
128
130
fs . cwd = cwd
129
131
const project = new Project ( fs , cwd )
130
132
const settings = await project . getBuildSettings ( )
131
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
132
- const sorted = settings . sort ( ( a , b ) => a . packagePath ! . localeCompare ( b . packagePath ! ) )
133
- expect ( sorted ) . toEqual ( [
134
- expect . objectContaining ( {
135
- baseDirectory : join ( 'apps/next' ) , // not executed via npm run so we need to have a base directory
136
- buildCommand : 'next build' ,
137
- devCommand : 'next' ,
138
- dist : join ( 'apps/next/.next' ) ,
139
- } ) ,
140
- expect . objectContaining ( {
141
- baseDirectory : '' , // executed via npm run so no base directory needed we can run from the root
142
- buildCommand : 'npm --workspace svelte-app run site:build' ,
143
- devCommand : 'npm --workspace svelte-app run site:start' ,
144
- dist : join ( 'apps/svelte/public' ) ,
145
- } ) ,
146
- ] )
133
+
134
+ expect ( settings ) . toEqual (
135
+ expect . arrayContaining ( [
136
+ expect . objectContaining ( {
137
+ baseDirectory : join ( 'apps/next' ) , // not executed via npm run so we need to have a base directory
138
+ buildCommand : 'next build' ,
139
+ devCommand : 'next' ,
140
+ dist : join ( 'apps/next/.next' ) ,
141
+ } ) ,
142
+ expect . objectContaining ( {
143
+ baseDirectory : '' , // executed via npm run so no base directory needed we can run from the root
144
+ buildCommand : 'npm --workspace svelte-app run site:build' ,
145
+ devCommand : 'npm --workspace svelte-app run site:start' ,
146
+ dist : join ( 'apps/svelte/public' ) ,
147
+ } ) ,
148
+ ] ) ,
149
+ )
147
150
} )
148
151
149
152
describe . each ( [
@@ -180,24 +183,25 @@ describe.each([
180
183
test ( `should get the settings from the root of the project` , async ( { fs, cwd } ) => {
181
184
const project = new Project ( fs , cwd )
182
185
const settings = await project . getBuildSettings ( )
183
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
184
- const sorted = settings . sort ( ( a , b ) => a . packagePath ! . localeCompare ( b . packagePath ! ) )
185
- expect ( sorted ) . toEqual ( [
186
- expect . objectContaining ( {
187
- baseDirectory : '' ,
188
- packagePath : platformJoin ( 'packages/blog' ) ,
189
- buildCommand : 'npm --workspace @evilcorp/blog run build' ,
190
- devCommand : 'npm --workspace @evilcorp/blog run dev' ,
191
- dist : platformJoin ( 'packages/blog/dist' ) ,
192
- } ) ,
193
- expect . objectContaining ( {
194
- baseDirectory : '' ,
195
- packagePath : platformJoin ( 'packages/website' ) ,
196
- buildCommand : 'npm --workspace @evilcorp/website run build' ,
197
- devCommand : 'npm --workspace @evilcorp/website run dev' ,
198
- dist : platformJoin ( 'packages/website/.next' ) ,
199
- } ) ,
200
- ] )
186
+
187
+ expect ( settings ) . toEqual (
188
+ expect . arrayContaining ( [
189
+ expect . objectContaining ( {
190
+ baseDirectory : '' ,
191
+ packagePath : platformJoin ( 'packages/website' ) ,
192
+ buildCommand : 'npm --workspace @evilcorp/website run build' ,
193
+ devCommand : 'npm --workspace @evilcorp/website run dev' ,
194
+ dist : platformJoin ( 'packages/website/.next' ) ,
195
+ } ) ,
196
+ expect . objectContaining ( {
197
+ baseDirectory : '' ,
198
+ packagePath : platformJoin ( 'packages/blog' ) ,
199
+ buildCommand : 'npm --workspace @evilcorp/blog run build' ,
200
+ devCommand : 'npm --workspace @evilcorp/blog run dev' ,
201
+ dist : platformJoin ( 'packages/blog/dist' ) ,
202
+ } ) ,
203
+ ] ) ,
204
+ )
201
205
} )
202
206
203
207
test ( `should get the settings from a package sub path` , async ( { fs, cwd } ) => {
@@ -225,25 +229,25 @@ describe.each([
225
229
test ( `should get the settings from the root of the project` , async ( { fs, cwd } ) => {
226
230
const project = new Project ( fs , cwd )
227
231
const settings = await project . getBuildSettings ( )
228
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
229
- const sorted = settings . sort ( ( a , b ) => a . packagePath ! . localeCompare ( b . packagePath ! ) )
230
232
231
- expect ( sorted ) . toEqual ( [
232
- expect . objectContaining ( {
233
- baseDirectory : '' ,
234
- packagePath : platformJoin ( 'packages/blog' ) ,
235
- buildCommand : 'pnpm --filter @evilcorp/blog... run build' ,
236
- devCommand : 'pnpm --filter @evilcorp/blog run dev' ,
237
- dist : platformJoin ( 'packages/blog/dist' ) ,
238
- } ) ,
239
- expect . objectContaining ( {
240
- baseDirectory : '' ,
241
- packagePath : platformJoin ( 'packages/website' ) ,
242
- buildCommand : 'pnpm --filter @evilcorp/website... run build' ,
243
- devCommand : 'pnpm --filter @evilcorp/website run dev' ,
244
- dist : platformJoin ( 'packages/website/.next' ) ,
245
- } ) ,
246
- ] )
233
+ expect ( settings ) . toEqual (
234
+ expect . arrayContaining ( [
235
+ expect . objectContaining ( {
236
+ baseDirectory : '' ,
237
+ packagePath : platformJoin ( 'packages/blog' ) ,
238
+ buildCommand : 'pnpm --filter @evilcorp/blog... run build' ,
239
+ devCommand : 'pnpm --filter @evilcorp/blog run dev' ,
240
+ dist : platformJoin ( 'packages/blog/dist' ) ,
241
+ } ) ,
242
+ expect . objectContaining ( {
243
+ baseDirectory : '' ,
244
+ packagePath : platformJoin ( 'packages/website' ) ,
245
+ buildCommand : 'pnpm --filter @evilcorp/website... run build' ,
246
+ devCommand : 'pnpm --filter @evilcorp/website run dev' ,
247
+ dist : platformJoin ( 'packages/website/.next' ) ,
248
+ } ) ,
249
+ ] ) ,
250
+ )
247
251
} )
248
252
249
253
test ( `should get the settings from a package sub path` , async ( { fs, cwd } ) => {
@@ -271,25 +275,25 @@ describe.each([
271
275
test ( `should get the settings from the root of the project` , async ( { fs, cwd } ) => {
272
276
const project = new Project ( fs , cwd )
273
277
const settings = await project . getBuildSettings ( )
274
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
275
- const sorted = settings . sort ( ( a , b ) => a . packagePath ! . localeCompare ( b . packagePath ! ) )
276
278
277
- expect ( sorted ) . toEqual ( [
278
- expect . objectContaining ( {
279
- baseDirectory : '' ,
280
- packagePath : platformJoin ( 'packages/blog' ) ,
281
- buildCommand : 'yarn workspace @evilcorp/blog build' ,
282
- devCommand : 'yarn workspace @evilcorp/blog dev' ,
283
- dist : platformJoin ( 'packages/blog/dist' ) ,
284
- } ) ,
285
- expect . objectContaining ( {
286
- baseDirectory : '' ,
287
- packagePath : platformJoin ( 'packages/website' ) ,
288
- buildCommand : 'yarn workspace @evilcorp/website build' ,
289
- devCommand : 'yarn workspace @evilcorp/website dev' ,
290
- dist : platformJoin ( 'packages/website/.next' ) ,
291
- } ) ,
292
- ] )
279
+ expect ( settings ) . toEqual (
280
+ expect . arrayContaining ( [
281
+ expect . objectContaining ( {
282
+ baseDirectory : '' ,
283
+ packagePath : platformJoin ( 'packages/blog' ) ,
284
+ buildCommand : 'yarn workspace @evilcorp/blog build' ,
285
+ devCommand : 'yarn workspace @evilcorp/blog dev' ,
286
+ dist : platformJoin ( 'packages/blog/dist' ) ,
287
+ } ) ,
288
+ expect . objectContaining ( {
289
+ baseDirectory : '' ,
290
+ packagePath : platformJoin ( 'packages/website' ) ,
291
+ buildCommand : 'yarn workspace @evilcorp/website build' ,
292
+ devCommand : 'yarn workspace @evilcorp/website dev' ,
293
+ dist : platformJoin ( 'packages/website/.next' ) ,
294
+ } ) ,
295
+ ] ) ,
296
+ )
293
297
} )
294
298
295
299
test ( `should get the settings from a package sub path` , async ( { fs, cwd } ) => {
@@ -317,25 +321,25 @@ describe.each([
317
321
test ( `should get the settings from the root of the project` , async ( { fs, cwd } ) => {
318
322
const project = new Project ( fs , cwd )
319
323
const settings = await project . getBuildSettings ( )
320
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
321
- const sorted = settings . sort ( ( a , b ) => a . packagePath ! . localeCompare ( b . packagePath ! ) )
322
324
323
- expect ( sorted ) . toEqual ( [
324
- expect . objectContaining ( {
325
- baseDirectory : '' ,
326
- packagePath : platformJoin ( 'apps/docs' ) ,
327
- buildCommand : 'turbo run build --filter docs' ,
328
- devCommand : 'turbo run dev --filter docs' ,
329
- dist : platformJoin ( 'apps/docs/.next' ) ,
330
- } ) ,
331
- expect . objectContaining ( {
332
- baseDirectory : '' ,
333
- packagePath : platformJoin ( 'apps/web' ) ,
334
- buildCommand : 'turbo run build --filter web' ,
335
- devCommand : 'turbo run dev --filter web' ,
336
- dist : platformJoin ( 'apps/web/.next' ) ,
337
- } ) ,
338
- ] )
325
+ expect ( settings ) . toEqual (
326
+ expect . arrayContaining ( [
327
+ expect . objectContaining ( {
328
+ baseDirectory : '' ,
329
+ packagePath : platformJoin ( 'apps/docs' ) ,
330
+ buildCommand : 'turbo run build --filter docs' ,
331
+ devCommand : 'turbo run dev --filter docs' ,
332
+ dist : platformJoin ( 'apps/docs/.next' ) ,
333
+ } ) ,
334
+ expect . objectContaining ( {
335
+ baseDirectory : '' ,
336
+ packagePath : platformJoin ( 'apps/web' ) ,
337
+ buildCommand : 'turbo run build --filter web' ,
338
+ devCommand : 'turbo run dev --filter web' ,
339
+ dist : platformJoin ( 'apps/web/.next' ) ,
340
+ } ) ,
341
+ ] ) ,
342
+ )
339
343
} )
340
344
341
345
test ( `should get the settings from a package sub path` , async ( { fs, cwd } ) => {
@@ -363,25 +367,25 @@ describe.each([
363
367
test ( `should get the settings from the root of the project` , async ( { fs, cwd } ) => {
364
368
const project = new Project ( fs , cwd )
365
369
const settings = await project . getBuildSettings ( )
366
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
367
- const sorted = settings . sort ( ( a , b ) => a . packagePath ! . localeCompare ( b . packagePath ! ) )
368
370
369
- expect ( sorted ) . toEqual ( [
370
- expect . objectContaining ( {
371
- baseDirectory : '' ,
372
- packagePath : platformJoin ( 'packages/astro' ) ,
373
- buildCommand : 'nx run astro:build' ,
374
- devCommand : 'nx run astro:dev' ,
375
- dist : platformJoin ( 'dist/packages/astro' ) ,
376
- } ) ,
377
- expect . objectContaining ( {
378
- baseDirectory : '' ,
379
- packagePath : platformJoin ( 'packages/website' ) ,
380
- buildCommand : 'nx run website:build' ,
381
- devCommand : 'nx run website:serve' ,
382
- dist : platformJoin ( 'dist/packages/website/.next' ) ,
383
- } ) ,
384
- ] )
371
+ expect ( settings ) . toEqual (
372
+ expect . arrayContaining ( [
373
+ expect . objectContaining ( {
374
+ baseDirectory : '' ,
375
+ packagePath : platformJoin ( 'packages/astro' ) ,
376
+ buildCommand : 'nx run astro:build' ,
377
+ devCommand : 'nx run astro:dev' ,
378
+ dist : platformJoin ( 'dist/packages/astro' ) ,
379
+ } ) ,
380
+ expect . objectContaining ( {
381
+ baseDirectory : '' ,
382
+ packagePath : platformJoin ( 'packages/website' ) ,
383
+ buildCommand : 'nx run website:build' ,
384
+ devCommand : 'nx run website:serve' ,
385
+ dist : platformJoin ( 'dist/packages/website/.next' ) ,
386
+ } ) ,
387
+ ] ) ,
388
+ )
385
389
} )
386
390
387
391
test ( `should get the settings from a package sub path` , async ( { fs, cwd } ) => {
@@ -409,32 +413,32 @@ describe.each([
409
413
test ( `should get the settings from the root of the project` , async ( { fs, cwd } ) => {
410
414
const project = new Project ( fs , cwd )
411
415
const settings = await project . getBuildSettings ( )
412
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
413
- const sorted = settings . sort ( ( a , b ) => a . packagePath ! . localeCompare ( b . packagePath ! ) )
414
416
415
- expect ( sorted ) . toEqual ( [
416
- expect . objectContaining ( {
417
- baseDirectory : '' ,
418
- packagePath : platformJoin ( 'apps/nuxt-app' ) ,
419
- buildCommand : 'nx run nuxt-app:build' ,
420
- devCommand : 'nx run nuxt-app:dev' ,
421
- dist : platformJoin ( 'apps/nuxt-app/dist' ) ,
422
- } ) ,
423
- expect . objectContaining ( {
424
- baseDirectory : '' ,
425
- packagePath : platformJoin ( 'apps/svelte-app' ) ,
426
- buildCommand : 'nx run svelte-app:build' ,
427
- devCommand : 'nx run svelte-app:dev' ,
428
- dist : platformJoin ( 'apps/svelte-app/build' ) ,
429
- } ) ,
430
- expect . objectContaining ( {
431
- baseDirectory : '' ,
432
- packagePath : platformJoin ( 'packages/ui-components' ) ,
433
- buildCommand : 'nx run @my-org/ui-components:build' ,
434
- devCommand : 'nx run @my-org/ui-components:start' ,
435
- dist : platformJoin ( 'packages/ui-components/www' ) ,
436
- } ) ,
437
- ] )
417
+ expect ( settings ) . toEqual (
418
+ expect . arrayContaining ( [
419
+ expect . objectContaining ( {
420
+ baseDirectory : '' ,
421
+ packagePath : platformJoin ( 'apps/nuxt-app' ) ,
422
+ buildCommand : 'nx run nuxt-app:build' ,
423
+ devCommand : 'nx run nuxt-app:dev' ,
424
+ dist : platformJoin ( 'apps/nuxt-app/dist' ) ,
425
+ } ) ,
426
+ expect . objectContaining ( {
427
+ baseDirectory : '' ,
428
+ packagePath : platformJoin ( 'apps/svelte-app' ) ,
429
+ buildCommand : 'nx run svelte-app:build' ,
430
+ devCommand : 'nx run svelte-app:dev' ,
431
+ dist : platformJoin ( 'apps/svelte-app/build' ) ,
432
+ } ) ,
433
+ expect . objectContaining ( {
434
+ baseDirectory : '' ,
435
+ packagePath : platformJoin ( 'packages/ui-components' ) ,
436
+ buildCommand : 'nx run @my-org/ui-components:build' ,
437
+ devCommand : 'nx run @my-org/ui-components:start' ,
438
+ dist : platformJoin ( 'packages/ui-components/www' ) ,
439
+ } ) ,
440
+ ] ) ,
441
+ )
438
442
} )
439
443
440
444
test ( `should get the settings from a package sub path` , async ( { fs, cwd } ) => {
0 commit comments