Skip to content

Commit

Permalink
add assertions back
Browse files Browse the repository at this point in the history
  • Loading branch information
flashdesignory committed Nov 5, 2024
1 parent b3d82bd commit 9a98948
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tests/benchmark-runner-tests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ describe("BenchmarkRunner", () => {
});

it("should prepare the suite first", async () => {
assert.calledOnce(_prepareSuiteSpy);
assert.calledTwice(_prepareSuiteSpy);
assert.calledOnce(_suitePrepareSpy);
assert.calledOnce(_loadFrameStub);
});
Expand Down
18 changes: 9 additions & 9 deletions tests/run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import serve from "./server.mjs";
import { Builder, Capabilities } from "selenium-webdriver";
import commandLineArgs from "command-line-args";
import commandLineUsage from "command-line-usage";
import assert from "assert";

const optionDefinitions = [
{ name: "browser", type: String, description: "Set the browser to test, choices are [safari, firefox, chrome]. By default the $BROWSER env variable is used." },
Expand Down Expand Up @@ -34,12 +35,10 @@ function printHelp(message = "") {

const options = commandLineArgs(optionDefinitions);

if ("help" in options)
printHelp();
if ("help" in options) printHelp();

const BROWSER = options?.browser;
if (!BROWSER)
printHelp("No browser specified, use $BROWSER or --browser");
if (!BROWSER) printHelp("No browser specified, use $BROWSER or --browser");

let capabilities;
switch (BROWSER) {
Expand Down Expand Up @@ -112,12 +111,13 @@ async function test() {
});

printTree(result.suite);
if (result.stats.failures > 0) {
console.error("\n\x1b[31m✖ Not all tests passed!\n");
process.exit(1);
}

console.log("\nChecking for passed tests...");
assert(result.stats.passes > 0);
console.log("Checking for failed tests...");
assert(result.stats.failures === 0);
} finally {
console.log("\n\x1b[32m✓ All tests passed!\n");
console.log("\nTests complete!");
driver.quit();
server.close();
}
Expand Down

0 comments on commit 9a98948

Please sign in to comment.