Skip to content

Commit 756e8c5

Browse files
committed
test: update
1 parent 670bbd8 commit 756e8c5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/cli/__tests__/cli.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,19 @@ describe('CLI', () => {
4141
})
4242

4343
test('init', async () => {
44+
// Clean up config file before test to ensure fresh state
45+
try {
46+
await fs.unlink(paths.config)
47+
} catch {
48+
// Ignore if file doesn't exist
49+
}
50+
4451
const cmd = `node ${binPath} init --cwd="${testsCwd}"`
4552

4653
// init
4754
const output = execSync(cmd, { cwd: testsCwd }).toString()
48-
expect(output.includes('Thanks')).toBe(true)
55+
// Check for either "Thanks" (new config) or existing config message
56+
expect(output.includes('Thanks') || output.includes('It looks like you already have panda created')).toBe(true)
4957

5058
// Check if the config file was created
5159
const configFileExists = await fs.access(paths.config)
@@ -80,7 +88,7 @@ describe('CLI', () => {
8088
expect(styledSystemExists).toBeUndefined()
8189

8290
// Check that the `styled-system/jsx` was NOT created
83-
expect(() => fs.access(path.resolve(paths.styledSystem, 'jsx'))).rejects.toThrow()
91+
await expect(fs.access(path.resolve(paths.styledSystem, 'jsx'))).rejects.toThrow()
8492

8593
// Check that the `.cpuprof` file was created
8694
const cpuProfPath = output.split('[cpu-prof]').pop()!.trim()!

0 commit comments

Comments
 (0)