Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(test): Document vitest issue in cli-helper test #11032

Merged
merged 1 commit into from
Jul 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions packages/cli-helpers/src/lib/__tests__/project.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,10 @@ describe('addEnvVar', () => {

describe('addEnvVar adds environment variables as part of a setup task', () => {
beforeEach(() => {
vi.spyOn(fs, 'existsSync').mockImplementation(() => {
return true
})
vi.spyOn(fs, 'existsSync').mockReturnValue(true)

// @ts-expect-error We're only returning a string rather than the expected Buffer | string
// which is determined by the options parameter passed to the real fs.readFileSync
vi.spyOn(fs, 'readFileSync').mockImplementation(() => {
return envFileContent
})
// @ts-expect-error https://github.com/vitest-dev/vitest/issues/6182
vi.spyOn(fs, 'readFileSync').mockImplementation(() => envFileContent)

vi.spyOn(fs, 'writeFileSync').mockImplementation((envPath, envFile) => {
expect(envPath).toContain('.env')
Expand Down Expand Up @@ -130,12 +125,9 @@ describe('addEnvVar', () => {
describe('updateTomlConfig', () => {
describe('updateTomlConfig configures a new CLI plugin', () => {
beforeEach(() => {
vi.spyOn(fs, 'existsSync').mockImplementation(() => {
return true
})
vi.spyOn(fs, 'existsSync').mockReturnValue(true)

// @ts-expect-error We're only returning a string rather than the expected Buffer | string
// which is determined by the options parameter passed to the real fs.readFileSync
// @ts-expect-error https://github.com/vitest-dev/vitest/issues/6182
vi.spyOn(fs, 'readFileSync').mockImplementation(() => {
return toml.stringify(defaultRedwoodToml)
})
Expand Down
Loading