-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds e2e tests for CI env and --force flag
- Loading branch information
1 parent
ac96a58
commit cb03371
Showing
3 changed files
with
68 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
packages/cli/ete-tests/src/tests/generate/output-directory-prompts.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { AbsoluteFilePath, join, RelativeFilePath } from "@fern-api/fs-utils"; | ||
import { cp, mkdir } from "fs/promises"; | ||
import tmp from "tmp-promise"; | ||
import { runFernCli } from "../../utils/runFernCli"; | ||
import stripAnsi from "strip-ansi"; | ||
import { init } from "../init/init"; | ||
import { Options } from "execa"; | ||
|
||
const envWithCI = { | ||
CI: "true" | ||
}; | ||
|
||
const envWithoutCI = { | ||
CI: "false" | ||
}; | ||
|
||
describe("output directory prompts", () => { | ||
it("doesn't show prompts for CI environment", async () => { | ||
const pathOfDirectory = await init(); | ||
|
||
const { stdout } = await runFernCli(["generate", "--local", "--keepDocker"], { | ||
cwd: pathOfDirectory, | ||
env: envWithCI | ||
}); | ||
|
||
const cleanOutput = stripAnsi(stdout).trim(); | ||
expect(cleanOutput).not.toContain("contains existing files"); | ||
expect(cleanOutput).not.toContain("Would you like to save this"); | ||
}, 180_000); | ||
|
||
it("doesn't show prompts with the --force flag", async () => { | ||
const pathOfDirectory = await init(); | ||
|
||
const { stdout } = await runFernCli(["generate", "--local", "--keepDocker", "--force"], { | ||
cwd: pathOfDirectory, | ||
env: envWithoutCI | ||
}); | ||
|
||
const cleanOutput = stripAnsi(stdout).trim(); | ||
expect(cleanOutput).not.toContain("contains existing files"); | ||
expect(cleanOutput).not.toContain("Would you like to save this"); | ||
}, 180_000); | ||
}); |