diff --git a/test/jest/acceptance/snyk-apps/create-app.spec.ts b/test/jest/acceptance/snyk-apps/create-app.spec.ts index 87ea965ad0..e75d23aae2 100644 --- a/test/jest/acceptance/snyk-apps/create-app.spec.ts +++ b/test/jest/acceptance/snyk-apps/create-app.spec.ts @@ -115,7 +115,7 @@ describe('snyk-apps: create app', () => { } = await runSnykCLIWithUserInputs( 'apps create --interactive --experimental', [testData.appName, ENTER, testData.redirectURIs, ENTER, ENTER], - { env }, + { env, delay: 200 }, ); // Assert expect(stdout).toContain("Your Snyk App's permission scopes"); @@ -158,7 +158,7 @@ describe('snyk-apps: create app', () => { testData.orgId, ENTER, ], - { env }, + { env, delay: 200 }, ); // Assert expect(code).toBe(0); diff --git a/test/jest/util/runCommand.ts b/test/jest/util/runCommand.ts index 12bbc31230..2516bf2017 100644 --- a/test/jest/util/runCommand.ts +++ b/test/jest/util/runCommand.ts @@ -7,7 +7,9 @@ type RunCommandResult = { stderr: string; }; -type RunCommandOptions = SpawnOptionsWithoutStdio; +interface RunCommandOptions extends SpawnOptionsWithoutStdio { + delay?: number; +} const runCommand = ( command: string, @@ -47,7 +49,7 @@ function runCommandsWithUserInputs( inputs: string[] = [], options?: RunCommandOptions, ): Promise { - const timeout = 100; + const timeout = options?.delay ?? 100; const childProcess = spawn(command, args, options); // Creates a loop to feed user inputs to the child process