mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2026-01-18 16:17:36 +00:00
This is what's causing the postcss test in #19434 to fail wanted to test this in isolation without the version bumps
59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import { describe } from 'vitest'
|
|
import { css, js, json, test } from '../utils'
|
|
|
|
const variantConfig = {
|
|
string: {
|
|
'postcss.config.js': js`
|
|
module.exports = {
|
|
plugins: {
|
|
tailwindcss: {},
|
|
},
|
|
}
|
|
`,
|
|
},
|
|
ESM: {
|
|
'postcss.config.mjs': js`
|
|
import tailwindcss from 'tailwindcss'
|
|
export default {
|
|
plugins: [tailwindcss()],
|
|
}
|
|
`,
|
|
},
|
|
CJS: {
|
|
'postcss.config.cjs': js`
|
|
let tailwindcss = require('tailwindcss')
|
|
module.exports = {
|
|
plugins: [tailwindcss()],
|
|
}
|
|
`,
|
|
},
|
|
}
|
|
|
|
describe.each(Object.keys(variantConfig))('%s', (variant) => {
|
|
test(
|
|
`can not use \`tailwindcss\` as a postcss module`,
|
|
{
|
|
fs: {
|
|
...variantConfig[variant],
|
|
'package.json': json`
|
|
{
|
|
"dependencies": {
|
|
"postcss": "^8",
|
|
"postcss-cli": "^10",
|
|
"tailwindcss": "workspace:^"
|
|
}
|
|
}
|
|
`,
|
|
'src/index.css': css`@import 'tailwindcss';`,
|
|
},
|
|
},
|
|
async ({ exec, expect }) => {
|
|
await expect(
|
|
exec('pnpm postcss src/index.css --output dist/out.css', undefined, { ignoreStdErr: true }),
|
|
).rejects.toThrowError(
|
|
`It looks like you're trying to use \`tailwindcss\` directly as a PostCSS plugin. The PostCSS plugin has moved to a separate package, so to continue using Tailwind CSS with PostCSS you'll need to install \`@tailwindcss/postcss\` and update your PostCSS configuration.`,
|
|
)
|
|
},
|
|
)
|
|
})
|