Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp-spiess committed Oct 10, 2024
1 parent bbb0a8e commit ffd7417
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions integrations/upgrade/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ test(
},
},
async ({ fs, exec }) => {
console.log(await exec('npx @tailwindcss/upgrade'))
await exec('npx @tailwindcss/upgrade')

await fs.expectFileToContain('src/index.css', css`@import 'tailwindcss';`)
await fs.expectFileToContain(
Expand Down Expand Up @@ -465,7 +465,7 @@ test(
},
},
async ({ fs, exec }) => {
console.log(await exec('npx @tailwindcss/upgrade'))
await exec('npx @tailwindcss/upgrade')

await fs.expectFileToContain('src/index.css', css`@import 'tailwindcss';`)
await fs.expectFileToContain(
Expand All @@ -476,16 +476,18 @@ test(
`,
)

let packageJsonContent = await fs.read('.postcssrc.json')
let packageJson = JSON.parse(packageJsonContent)
expect(packageJson).toMatchInlineSnapshot(`
let jsonConfigContent = await fs.read('.postcssrc.json')
let jsonConfig = JSON.parse(jsonConfigContent)
expect(jsonConfig).toMatchInlineSnapshot(`
{
"plugins": {
"@tailwindcss/postcss": {},
},
}
`)

let packageJsonContent = await fs.read('package.json')
let packageJson = JSON.parse(packageJsonContent)
expect(packageJson.dependencies).toMatchObject({
tailwindcss: expect.stringContaining('4.0.0'),
})
Expand Down
2 changes: 1 addition & 1 deletion packages/@tailwindcss-upgrade/src/migrate-postcss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export async function migratePostCSSConfig(base: string) {
// Priority 3: JSON based postcss config files
let jsonConfigPath = await detectJSONConfigPath(base)
let jsonConfig: null | any = null
if (jsonConfigPath) {
if (!didMigrate && jsonConfigPath) {
try {
jsonConfig = JSON.parse(await fs.readFile(jsonConfigPath, 'utf-8'))
} catch {}
Expand Down

0 comments on commit ffd7417

Please sign in to comment.