Skip to content

Commit

Permalink
refactor: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Varun0157 committed Jun 26, 2024
1 parent 10d1455 commit 147534d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions src/getResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function formatRoute(
et: string | number,
size: number,
passedCount: number,
allCount: number
allCount: number,
) {
let line = C_TIME(`${new Date().toLocaleString()}`);
if (allCount === passedCount) {
Expand Down Expand Up @@ -85,7 +85,7 @@ function formatRouteParseError(
status: number | undefined,
size: number,
et: string | number,
parseError: string
parseError: string,
) {
const line =
C_TIME(`${new Date().toLocaleString()}`) +
Expand Down Expand Up @@ -115,7 +115,7 @@ function formatTestResults(
results: TestResult[],
lastResult: TestResult | undefined,
skip: boolean,
indented: boolean
indented: boolean,
): string[] {
const resultLines: string[] = [];
for (const [i, r] of results.entries()) {
Expand All @@ -124,8 +124,8 @@ function formatTestResults(
? "└"
: "├" // flat view
: i === results.length - 1
? "└"
: "├"; // indented/nested view
? "└"
: "├"; // indented/nested view

// Indented presentation displays spec on a dedicated line, otherwise specs are displayed inline.
const specToken = spec && !indented ? `${spec} ` : "";
Expand Down Expand Up @@ -183,7 +183,7 @@ function getFormattedResult(
status: number | undefined,
size: number,
execTime: string | number,
indented: boolean
indented: boolean,
): [string, number, number] {
function getResultData(res: SpecResult): [number, number] {
const rootResults = res.results;
Expand All @@ -206,7 +206,7 @@ function getFormattedResult(
function getIndentedResult(
res: SpecResult,
indent: number,
lastResult: TestResult | undefined
lastResult: TestResult | undefined,
): string {
const offset = " ";
const inset = requestDetailInset + (indented ? offset.repeat(Math.max(1, indent - 1)) : "");
Expand All @@ -217,7 +217,7 @@ function getFormattedResult(
res.results,
lastResult,
res.skipped ?? false,
indented
indented,
).join("\n");

const subRes: string[] = [];
Expand Down Expand Up @@ -280,7 +280,7 @@ export async function allRequestsWithProgress(
allRequests: {
[name: string]: RequestSpec;
},
rawReq: RawRequest
rawReq: RawRequest,
): Promise<Array<SpecResponse>> {
let currHttpRequest: GotRequest;
const responses: Array<SpecResponse> = [];
Expand Down Expand Up @@ -358,7 +358,7 @@ export async function allRequestsWithProgress(
status,
size,
et,
rawReq.indent
rawReq.indent,
);
if (passed !== all) process.exitCode = getStatusCode() + 1;

Expand Down
6 changes: 3 additions & 3 deletions src/runRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { BundleResult } from "./bundleResult";

async function runRequestSpecs(
requests: { [name: string]: RequestSpec },
rawRequest: RawRequest
rawRequest: RawRequest,
): Promise<BundleResult> {
for (const name in requests) {
const request = requests[name];
Expand Down Expand Up @@ -44,7 +44,7 @@ async function runRequestSpecs(
req.options.keepRawJSON,
req.options.showHeaders,
rawRequest.envName,
rawRequest.expand
rawRequest.expand,
);
}

Expand All @@ -60,7 +60,7 @@ export async function callRequests(request: RawRequest): Promise<BundleResult> {
const loadedVariables: Variables = loadVariables(
env,
request.bundle.bundleContents,
getVarFileContents(path.dirname(request.bundle.bundlePath))
getVarFileContents(path.dirname(request.bundle.bundlePath)),
);
if (env && Object.keys(loadedVariables).length < 1)
console.error(C_WARN(`warning: no variables added from env "${env}". Does it exist?`));
Expand Down

0 comments on commit 147534d

Please sign in to comment.