-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
43 lines (38 loc) · 1.46 KB
/
test.js
File metadata and controls
43 lines (38 loc) · 1.46 KB
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
34
35
36
37
38
39
40
41
42
43
/// test.js
const fs = require('fs');
const path = require('path');
console.log("====================================================");
console.log(" Quantova Enterprise SDK Global Test Suite ");
console.log("====================================================\n");
const testsDir = path.join(__dirname, 'tests');
const testFiles = fs.readdirSync(testsDir).filter(file => file.endsWith('.test.js')).sort();
(async () => {
let successCount = 0;
let failureCount = 0;
for (const file of testFiles) {
try {
const testPath = path.join(testsDir, file);
const testModule = require(testPath);
if (typeof testModule.run === 'function') {
await testModule.run(); // supports sync and async suites
successCount++;
}
} catch (err) {
console.error(`\u2717 Test suite "${file}" failed:`, err && err.message ? err.message : err);
failureCount++;
}
}
console.log("\n====================================================");
console.log(` Tests Execution Summary:`);
console.log(` - Total Suites Run: ${successCount + failureCount}`);
console.log(` - Passed Suites: ${successCount}`);
console.log(` - Failed Suites: ${failureCount}`);
console.log("====================================================");
if (failureCount === 0) {
console.log("\u2705 ALL TEST SUITES PASSED.");
process.exit(0);
} else {
console.log("\u274c SOME TEST SUITES FAILED.");
process.exit(1);
}
})();