Skip to content

Commit 89e55e6

Browse files
committed
test: don't break the tests until all of them finish
1 parent 86f8001 commit 89e55e6

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

spec/test.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async function testLint(packedPkg, testRepo, isWorkspace = false, isSilent = fal
3939
shell: true,
4040
})
4141
} catch (e) {
42-
console.log("\nPlease rerun pnpm test. This error happens because pnpm cannot delete locked files \n")
42+
console.error("\nPlease rerun pnpm test. This error happens because pnpm cannot delete locked files \n")
4343
throw e
4444
}
4545

@@ -56,12 +56,28 @@ async function testLint(packedPkg, testRepo, isWorkspace = false, isSilent = fal
5656
rm("-rf", packedPkg)
5757
await execa.command("pnpm pack", { cwd: root })
5858

59+
const errs = []
5960
for (const testRepo of testRepos) {
60-
// We want to observe the output in order, so we await inside loop
61-
await testLint(packedPkg, testRepo, false) // eslint-disable-line no-await-in-loop
61+
try {
62+
// We want to observe the output in order, so we await inside loop
63+
await testLint(packedPkg, testRepo, false) // eslint-disable-line no-await-in-loop
64+
} catch (err) {
65+
console.error(err)
66+
errs.push(err)
67+
}
6268
}
69+
6370
for (const testWorkspace of testWorkspaces) {
64-
await testLint(packedPkg, testWorkspace, true, true) // eslint-disable-line no-await-in-loop
71+
try {
72+
await testLint(packedPkg, testWorkspace, true, true) // eslint-disable-line no-await-in-loop
73+
} catch (err) {
74+
console.error(err)
75+
errs.push(err)
76+
}
77+
}
78+
if (errs.length !== 0) {
79+
rm("-rf", packedPkg)
80+
throw new Error(`${errs.length} packages failed the tests. See the above.`)
6581
}
6682

6783
rm("-rf", packedPkg)

0 commit comments

Comments
 (0)