Skip to content

Commit

Permalink
feat: introduced stop on failure option
Browse files Browse the repository at this point in the history
  • Loading branch information
Varun0157 committed May 11, 2024
1 parent 39210d9 commit 04a46db
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/mergeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ function getMergedOptions(cOptions: RawOptions = {}, rOptions: RawOptions = {}):
const keepRawJSON = options.keepRawJSON == true;
const showHeaders = options.showHeaders == true;
const rawParams = options.rawParams == true;
const stopOnFailure = options.stopOnFailure == true;

return { follow, verifySSL, keepRawJSON, showHeaders, rawParams };
return { follow, verifySSL, keepRawJSON, showHeaders, rawParams, stopOnFailure };
}

function getMergedSetVars(
Expand Down
2 changes: 2 additions & 0 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface Options {
keepRawJSON: boolean;
showHeaders: boolean;
rawParams: boolean;
stopOnFailure: boolean;
}

export type Assertion = number | boolean | string | null | { [op: string]: any };
Expand Down Expand Up @@ -50,6 +51,7 @@ export interface RawOptions {
keepRawJSON?: boolean;
showHeaders?: boolean;
rawParams?: boolean;
stopOnFailure?: boolean;
}

export interface RawTests {
Expand Down
6 changes: 5 additions & 1 deletion src/runTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import { getStringIfNotScalar } from "./utils/typeUtils";

import { Tests, ResponseData, TestResult, Assertion } from "./models";

export function runAllTests(tests: Tests, responseData: ResponseData): TestResult[] {
export function runAllTests(
tests: Tests,
responseData: ResponseData,
stopOnFailure: boolean
): TestResult[] {
const results: TestResult[] = [];
if (!tests) return results;

Expand Down

0 comments on commit 04a46db

Please sign in to comment.