Skip to content

Commit 7259dd7

Browse files
committed
ensure test:e2e command runs all e2e suites in a given folder
1 parent 9f4eb3b commit 7259dd7

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

test/runE2E.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,26 @@ if (!suiteName) {
8282

8383
// Run specific suite
8484
clearWebpackCache()
85-
const suitePath: string | undefined = path
86-
.resolve(dirname, inputSuitePath, 'e2e.spec.ts')
85+
const suiteFolderPath: string | undefined = path
86+
.resolve(dirname, inputSuitePath)
8787
.replaceAll('__', '/')
8888

89+
const allSuitesInFolder = await globby(`${suiteFolderPath.replace(/\\/g, '/')}/**/*e2e.spec.ts`)
90+
8991
const baseTestFolder = inputSuitePath.split('__')[0]
9092

91-
if (!suitePath || !baseTestFolder) {
93+
if (!baseTestFolder || !allSuitesInFolder?.length) {
9294
throw new Error(`No test suite found for ${suiteName}`)
9395
}
9496

95-
executePlaywright(suitePath, baseTestFolder, false, suiteConfigPath)
97+
console.log(`\n\nExecuting all ${allSuitesInFolder.length} E2E tests...\n\n`)
98+
99+
console.log(`${allSuitesInFolder.join('\n')}\n`)
100+
101+
for (const file of allSuitesInFolder) {
102+
clearWebpackCache()
103+
executePlaywright(file, baseTestFolder, false, suiteConfigPath)
104+
}
96105
}
97106

98107
console.log('\nRESULTS:')

0 commit comments

Comments
 (0)