Skip to content

Commit

Permalink
chore: fix test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
rhamzeh committed Sep 6, 2024
1 parent 2a7a6b2 commit 4bf6d98
Showing 1 changed file with 20 additions and 23 deletions.
43 changes: 20 additions & 23 deletions client/src/test/index.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,25 @@ export function run(): Promise<void> {

const testsRoot = __dirname;

return new Promise((resolve, reject) => {
glob("**.test.js", { cwd: testsRoot }, (err, files) => {
if (err) {
return reject(err);
}
return glob.glob("**.test.js", { cwd: testsRoot }).then(
(files) =>
new Promise((resolve, reject) => {
// Add files to the test suite
files.forEach((f) => mocha.addFile(path.resolve(testsRoot, f)));

// Add files to the test suite
files.forEach((f) => mocha.addFile(path.resolve(testsRoot, f)));

try {
// Run the mocha test
mocha.run((failures) => {
if (failures > 0) {
reject(new Error(`${failures} tests failed.`));
} else {
resolve();
}
});
} catch (err) {
console.error(err);
reject(err);
}
});
});
try {
// Run the mocha test
mocha.run((failures) => {
if (failures > 0) {
reject(new Error(`${failures} tests failed.`));
} else {
resolve();
}
});
} catch (err) {
console.error(err);
reject(err);
}
}),
);
}

0 comments on commit 4bf6d98

Please sign in to comment.