@@ -3,6 +3,21 @@ import { options, runCommandMock } from 'test-utils'
33import { Cooker } from 'repo-cooker'
44import assert from 'test-utils/assert'
55
6+ function normalizeOutput ( output ) {
7+ return Object . keys ( output ) . reduce ( ( acc , key ) => {
8+ const value = output [ key ]
9+ // Sort commands array to handle non-deterministic async order
10+ if ( key === 'commands' && Array . isArray ( value ) ) {
11+ acc [ key ] = [ ...value ] . sort ( ( a , b ) =>
12+ ( a . options ?. cwd || '' ) . localeCompare ( b . options ?. cwd || '' )
13+ )
14+ } else {
15+ acc [ key ] = value
16+ }
17+ return acc
18+ } , { } )
19+ }
20+
621export function testAction (
722 action ,
823 input ,
@@ -13,7 +28,7 @@ export function testAction(
1328) {
1429 const dryRun = runCommandMock ( )
1530 const fullOptions = Object . assign ( { } , options , { dryRun } , extraOptions )
16- const cooker = Cooker ( [ '--no-parallel' ] , fullOptions )
31+ const cooker = Cooker ( fullOptions )
1732
1833 cooker
1934 . run ( [
@@ -26,11 +41,13 @@ export function testAction(
2641 action ,
2742 ( { props } ) => {
2843 assert . deepEqual (
29- Object . keys ( output ) . reduce ( ( acc , key ) => {
30- acc [ key ] = props [ key ]
31- return acc
32- } , { } ) ,
33- output ,
44+ normalizeOutput (
45+ Object . keys ( output ) . reduce ( ( acc , key ) => {
46+ acc [ key ] = props [ key ]
47+ return acc
48+ } , { } )
49+ ) ,
50+ normalizeOutput ( output ) ,
3451 done
3552 )
3653 } ,
0 commit comments