| 10 | import * as fs from 'fs/promises'; |
| 11 | |
| 12 | export async function run(): Promise<void> { |
| 13 | console.log('Starting E2E tests...'); |
| 14 | const testsRoot = path.resolve(__dirname); |
| 15 | const entries = await fs.readdir(testsRoot); |
| 16 | const files = entries.filter((f) => f.endsWith('.js') && f !== 'index.js'); |
| 17 | |
| 18 | console.log(`Found ${files.length} test files to run...`); |
| 19 | |
| 20 | // Run tests sequentially and wait for them if they are async |
| 21 | for (const file of files) { |
| 22 | const testPath = path.join(testsRoot, file); |
| 23 | console.log(`Running test: ${file}`); |
| 24 | const testModule = require(testPath); |
| 25 | if (testModule.run) { |
| 26 | await testModule.run(); |
| 27 | } |
| 28 | } |
| 29 | } |