Skip to content

Commit d86af92

Browse files
Add example for not migarting complex configs
1 parent 1d04ce1 commit d86af92

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

integrations/upgrade/js-config.test.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,52 @@ test(
101101
expect((await fs.dumpFiles('tailwind.config.ts')).trim()).toBe('')
102102
},
103103
)
104+
105+
test(
106+
`does not upgrade a complex JS config file to CSS`,
107+
{
108+
fs: {
109+
'package.json': json`
110+
{
111+
"dependencies": {
112+
"@tailwindcss/upgrade": "workspace:^"
113+
}
114+
}
115+
`,
116+
'tailwind.config.ts': ts`
117+
import { type Config } from 'tailwindcss'
118+
119+
export default {
120+
plugins: [function complexConfig() {}],
121+
} satisfies Config
122+
`,
123+
'src/input.css': css`
124+
@tailwind base;
125+
@tailwind components;
126+
@tailwind utilities;
127+
`,
128+
},
129+
},
130+
async ({ exec, fs }) => {
131+
await exec('npx @tailwindcss/upgrade')
132+
133+
expect(await fs.dumpFiles('src/**/*.css')).toMatchInlineSnapshot(`
134+
"
135+
--- src/input.css ---
136+
@import 'tailwindcss';
137+
@config '../tailwind.config.ts';
138+
"
139+
`)
140+
141+
expect(await fs.dumpFiles('tailwind.config.ts')).toMatchInlineSnapshot(`
142+
"
143+
--- tailwind.config.ts ---
144+
import { type Config } from 'tailwindcss'
145+
146+
export default {
147+
plugins: [function complexConfig() {}],
148+
} satisfies Config
149+
"
150+
`)
151+
},
152+
)

0 commit comments

Comments
 (0)