Skip to content

Commit

Permalink
Merge pull request #3073 from snyk/fix/flaky-acceptance-tests
Browse files Browse the repository at this point in the history
fix: Increase delay between inputs on some acceptance tests
  • Loading branch information
jgresty authored Mar 29, 2022
2 parents c8c39a5 + 41b7f9e commit 69b5266
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/jest/acceptance/snyk-apps/create-app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -158,7 +158,7 @@ describe('snyk-apps: create app', () => {
testData.orgId,
ENTER,
],
{ env },
{ env, delay: 200 },
);
// Assert
expect(code).toBe(0);
Expand Down
6 changes: 4 additions & 2 deletions test/jest/util/runCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ type RunCommandResult = {
stderr: string;
};

type RunCommandOptions = SpawnOptionsWithoutStdio;
interface RunCommandOptions extends SpawnOptionsWithoutStdio {
delay?: number;
}

const runCommand = (
command: string,
Expand Down Expand Up @@ -47,7 +49,7 @@ function runCommandsWithUserInputs(
inputs: string[] = [],
options?: RunCommandOptions,
): Promise<any> {
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
Expand Down

0 comments on commit 69b5266

Please sign in to comment.