Skip to content

Commit

Permalink
refactor: streamlined stopOnFailure to only check when required
Browse files Browse the repository at this point in the history
  • Loading branch information
Varun0157 committed May 28, 2024
1 parent 76c1e09 commit 598564d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/runTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ export function runAllTests(
const results: TestResult[] = [];
if (!tests) return results;

let statusFail = false;
if (tests.status) {
const expected = tests.status;
const received = responseData.status;
const statusResults = runTest("status", expected, received);
results.push(...statusResults);
statusFail = statusResults.some((r) => !r.pass);

if (stopOnFailure && statusResults.some((r) => !r.pass)) return results;
}
if (stopOnFailure && statusFail) return results;

for (const spec in tests.headers) {
const expected = tests.headers[spec];
Expand Down

0 comments on commit 598564d

Please sign in to comment.