Skip to content

Commit fe86e9f

Browse files
committed
test: fail prepare fixtures script if fixtures fail to install deps or build a fixture
1 parent 5a2d6fa commit fe86e9f

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

tests/prepare.mjs

+23-1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ const promises = fixtures.map((fixture) =>
8080
operation: 'revert',
8181
})
8282
}
83+
if (output.exitCode !== 0) {
84+
const errorMessage = `[${fixture}] Failed to install dependencies or build a fixture`
85+
console.error(errorMessage)
86+
throw new Error(errorMessage)
87+
}
8388
fixtureList.delete(fixture)
8489
})
8590
}).finally(() => {
@@ -91,5 +96,22 @@ const promises = fixtures.map((fixture) =>
9196
}
9297
}),
9398
)
94-
await Promise.allSettled(promises)
99+
const prepareFixturesResults = await Promise.allSettled(promises)
100+
const failedFixturesErrors = prepareFixturesResults
101+
.map((promise) => {
102+
if (promise.status === 'rejected') {
103+
return promise.reason
104+
}
105+
return null
106+
})
107+
.filter(Boolean)
108+
109+
if (failedFixturesErrors.length > 0) {
110+
console.error('🚨 Some fixtures failed to prepare:')
111+
for (const error of failedFixturesErrors) {
112+
console.error(error)
113+
}
114+
process.exit(1)
115+
}
116+
95117
console.log('🎉 All fixtures prepared')

0 commit comments

Comments
 (0)