-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_smart_tests.mjs
More file actions
33 lines (28 loc) · 948 Bytes
/
run_smart_tests.mjs
File metadata and controls
33 lines (28 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import assert from 'node:assert/strict';
import { test, strip_logic_from_content } from './src/strip_logic_from_content.mjs';
async function run_tests() {
if (typeof test.setup === 'function') await test.setup();
let passed = 0;
let failed = 0;
for (const testCase of test.cases) {
if (typeof testCase.before === 'function') await testCase.before.call(testCase);
try {
await testCase.assert.call(testCase, assert);
console.log(`✅ Test case "${testCase.name}" passed.`);
passed++;
} catch (error) {
console.error(`❌ Test case "${testCase.name}" failed:`, error);
failed++;
}
}
console.log(`All tests run: ${passed} passed, ${failed} failed.`);
if (failed > 0) {
process.exit(1);
}
}
try {
await run_tests();
} catch (error) {
console.error('Test execution failed:', error);
process.exit(1);
}