codi-test-framework
Advanced tools
Comparing version 0.0.15 to 0.0.16
{ | ||
"name": "codi-test-framework", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "A simple test framework for JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "src/testRunner.js", |
@@ -80,2 +80,34 @@ import fs from 'fs'; | ||
// 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 | ||
@@ -82,0 +114,0 @@ export function runCLI() { |
15461
205