Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
test: bump timeout
jamesgeorge0073fc43cc9b96d
diff --git a/packages/hoppscotch-cli/src/__tests__/e2e/commands/test.spec.ts b/packages/hoppscotch-cli/src/__tests__/e2e/commands/test.spec.tsindex a2fe12235..ef8497e03 100644--- a/packages/hoppscotch-cli/src/__tests__/e2e/commands/test.spec.ts+++ b/packages/hoppscotch-cli/src/__tests__/e2e/commands/test.spec.ts@@ -6,7 +6,7 @@ import path from "path";import { HoppErrorCode } from "../../../types/errors";import { getErrorCode, getTestJsonFilePath, runCLI } from "../../utils";-describe("hopp test [options] <file_path_or_id>", () => {+describe("hopp test [options] <file_path_or_id>", { timeout: 100000 }, () => {const VALID_TEST_ARGS = `test ${getTestJsonFilePath("passes-coll.json", "collection")}`;describe("Test `hopp test <file_path_or_id>` command:", () => {@@ -126,19 +126,15 @@ describe("hopp test [options] <file_path_or_id>", () => {expect(error).toBeNull();});- test(- "Successfully inherits/overrides authorization and headers at each level with multiple child collections",- async () => {- const args = `test ${getTestJsonFilePath(- "multiple-child-collections-auth-headers-coll.json",- "collection"- )}`;- const { error } = await runCLI(args);+ test("Successfully inherits/overrides authorization and headers at each level with multiple child collections", async () => {+ const args = `test ${getTestJsonFilePath(+ "multiple-child-collections-auth-headers-coll.json",+ "collection"+ )}`;+ const { error } = await runCLI(args);- expect(error).toBeNull();- },- { timeout: 100000 }- );+ expect(error).toBeNull();+ });test("Persists environment variables set in the pre-request script for consumption in the test script", async () => {const args = `test ${getTestJsonFilePath(@@ -277,97 +273,93 @@ describe("hopp test [options] <file_path_or_id>", () => {expect(error).toBeNull();});- describe(- "Secret environment variables",- () => {- // Reads secret environment values from system environment- test("Successfully picks the values for secret environment variables from `process.env` and persists the variables set from the pre-request script", async () => {- const env = {- ...process.env,- secretBearerToken: "test-token",- secretBasicAuthUsername: "test-user",- secretBasicAuthPassword: "test-pass",- secretQueryParamValue: "secret-query-param-value",- secretBodyValue: "secret-body-value",- secretHeaderValue: "secret-header-value",- };-- const COLL_PATH = getTestJsonFilePath(- "secret-envs-coll.json",- "collection"- );- const ENVS_PATH = getTestJsonFilePath(- "secret-envs.json",- "environment"- );- const args = `test ${COLL_PATH} --env ${ENVS_PATH}`;-- const { error, stdout } = await runCLI(args, { env });-- expect(stdout).toContain(- "https://httpbin.org/basic-auth/*********/*********"- );- expect(error).toBeNull();- });+ describe("Secret environment variables", () => {+ // Reads secret environment values from system environment+ test("Successfully picks the values for secret environment variables from `process.env` and persists the variables set from the pre-request script", async () => {+ const env = {+ ...process.env,+ secretBearerToken: "test-token",+ secretBasicAuthUsername: "test-user",+ secretBasicAuthPassword: "test-pass",+ secretQueryParamValue: "secret-query-param-value",+ secretBodyValue: "secret-body-value",+ secretHeaderValue: "secret-header-value",+ };- // Prefers values specified in the environment export file over values set in the system environment- test("Successfully picks the values for secret environment variables set directly in the environment export file and persists the environment variables set from the pre-request script", async () => {- const COLL_PATH = getTestJsonFilePath(- "secret-envs-coll.json",- "collection"- );- const ENVS_PATH = getTestJsonFilePath(- "secret-supplied-values-envs.json",- "environment"- );- const args = `test ${COLL_PATH} --env ${ENVS_PATH}`;-- const { error, stdout } = await runCLI(args);-- expect(stdout).toContain(- "https://httpbin.org/basic-auth/*********/*********"- );- expect(error).toBeNull();- });+ const COLL_PATH = getTestJsonFilePath(+ "secret-envs-coll.json",+ "collection"+ );+ const ENVS_PATH = getTestJsonFilePath(+ "secret-envs.json",+ "environment"+ );+ const args = `test ${COLL_PATH} --env ${ENVS_PATH}`;- // Values set from the scripting context takes the highest precedence- test("Setting values for secret environment variables from the pre-request script overrides values set at the supplied environment export file", async () => {- const COLL_PATH = getTestJsonFilePath(- "secret-envs-persistence-coll.json",- "collection"- );- const ENVS_PATH = getTestJsonFilePath(- "secret-supplied-values-envs.json",- "environment"- );- const args = `test ${COLL_PATH} --env ${ENVS_PATH}`;-- const { error, stdout } = await runCLI(args);-- expect(stdout).toContain(- "https://httpbin.org/basic-auth/*********/*********"- );- expect(error).toBeNull();- });+ const { error, stdout } = await runCLI(args, { env });++ expect(stdout).toContain(+ "https://httpbin.org/basic-auth/*********/*********"+ );+ expect(error).toBeNull();+ });++ // Prefers values specified in the environment export file over values set in the system environment+ test("Successfully picks the values for secret environment variables set directly in the environment export file and persists the environment variables set from the pre-request script", async () => {+ const COLL_PATH = getTestJsonFilePath(+ "secret-envs-coll.json",+ "collection"+ );+ const ENVS_PATH = getTestJsonFilePath(+ "secret-supplied-values-envs.json",+ "environment"+ );+ const args = `test ${COLL_PATH} --env ${ENVS_PATH}`;- test("Persists secret environment variable values set from the pre-request script for consumption in the request and post-request script context", async () => {- const COLL_PATH = getTestJsonFilePath(- "secret-envs-persistence-scripting-coll.json",- "collection"- );- const ENVS_PATH = getTestJsonFilePath(- "secret-envs-persistence-scripting-envs.json",- "environment"- );+ const { error, stdout } = await runCLI(args);- const args = `test ${COLL_PATH} --env ${ENVS_PATH}`;+ expect(stdout).toContain(+ "https://httpbin.org/basic-auth/*********/*********"+ );+ expect(error).toBeNull();+ });- const { error } = await runCLI(args);- expect(error).toBeNull();- });- },- { timeout: 50000 }- );+ // Values set from the scripting context takes the highest precedence+ test("Setting values for secret environment variables from the pre-request script overrides values set at the supplied environment export file", async () => {+ const COLL_PATH = getTestJsonFilePath(+ "secret-envs-persistence-coll.json",+ "collection"+ );+ const ENVS_PATH = getTestJsonFilePath(+ "secret-supplied-values-envs.json",+ "environment"+ );+ const args = `test ${COLL_PATH} --env ${ENVS_PATH}`;++ const { error, stdout } = await runCLI(args);++ expect(stdout).toContain(+ "https://httpbin.org/basic-auth/*********/*********"+ );+ expect(error).toBeNull();+ });++ test("Persists secret environment variable values set from the pre-request script for consumption in the request and post-request script context", async () => {+ const COLL_PATH = getTestJsonFilePath(+ "secret-envs-persistence-scripting-coll.json",+ "collection"+ );+ const ENVS_PATH = getTestJsonFilePath(+ "secret-envs-persistence-scripting-envs.json",+ "environment"+ );++ const args = `test ${COLL_PATH} --env ${ENVS_PATH}`;++ const { error } = await runCLI(args);+ expect(error).toBeNull();+ });+ });describe("Request variables", () => {test("Picks active request variables and ignores inactive entries alongside the usage of environment variables", async () => {