Skip to content

Commit d4d8296

Browse files
committed
Add test for ESM postcss configs
1 parent b7e27ac commit d4d8296

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

integrations/tailwindcss-cli/tests/cli.test.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,37 @@ describe('Build command', () => {
391391
expect(contents).toContain(`/*# sourceMappingURL`)
392392
})
393393

394+
test('--postcss supports ESM configs', async () => {
395+
await writeInputFile('index.html', html`<div class="font-bold"></div>`)
396+
397+
let customConfig = javascript`
398+
export default {
399+
map: { inline: true },
400+
plugins: [
401+
function tailwindcss() {
402+
return require(path.resolve('..', '..'))
403+
},
404+
],
405+
}
406+
`
407+
408+
await writeInputFile('../postcss.config.mjs', customConfig)
409+
410+
await $(`${EXECUTABLE} --output ./dist/main.css --postcss postcss.config.mjs`)
411+
412+
let contents = await readOutputFile('main.css')
413+
414+
expect(contents).toIncludeCss(
415+
css`
416+
.font-bold {
417+
font-weight: 700;
418+
}
419+
`
420+
)
421+
422+
expect(contents).toContain(`/*# sourceMappingURL`)
423+
})
424+
394425
test('postcss-import is supported by default', async () => {
395426
cleanupFile('src/test.css')
396427

0 commit comments

Comments
 (0)