Skip to content

Commit

Permalink
Web Test Runner
Browse files Browse the repository at this point in the history
  • Loading branch information
RobAndrewHurst committed Apr 5, 2024
1 parent 654f917 commit 7c2970b
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/testRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,38 @@ export async function runTests(testDirectory) {
}
}

// Function to run a single test file
async function runWebTestFile(testFile) {
try {
await import(testFile);
} catch (error) {
console.error(`Error running test file ${testFile}:`);
console.error(error.stack);
failedTests++;
}
}

// Function to run all test files
export async function runWebTests(testFiles) {
console.log(`Running ${testFiles.length} test file(s)`);

// Run each test file sequentially
for (const file of testFiles) {
await runWebTestFile(file);
}

// Print the test summary
console.log('Test Summary:');
console.log(` Passed: ${passedTests}`);
console.log(` Failed: ${failedTests}`);

// Return the test results
return {
passed: passedTests,
failed: failedTests
};
}

// CLI function
export function runCLI() {
const testDirectory = process.argv[2];
Expand Down

0 comments on commit 7c2970b

Please sign in to comment.