Skip to content

Commit 7f97d12

Browse files
committed
Add test for import.meta in ESM config files
1 parent 510ce12 commit 7f97d12

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,45 @@ describe('Build command', () => {
207207
)
208208
})
209209

210+
test('configs support import.meta', async () => {
211+
await writeInputFile('index.html', html`<div class="font-bold"></div>`)
212+
213+
let customConfig = `
214+
console.log(import.meta.url)
215+
console.log(import.meta.resolve('./tailwind.config.mjs'))
216+
export default ${JSON.stringify(
217+
{
218+
content: ['./src/index.html'],
219+
theme: {
220+
extend: {
221+
fontWeight: {
222+
bold: 'BOLD',
223+
},
224+
},
225+
},
226+
corePlugins: {
227+
preflight: false,
228+
},
229+
plugins: [],
230+
},
231+
null,
232+
2
233+
)}
234+
`
235+
236+
await writeInputFile('../tailwind.config.mjs', customConfig)
237+
238+
await $(`${EXECUTABLE} --output ./dist/main.css --config ./tailwind.config.mjs`)
239+
240+
expect(await readOutputFile('main.css')).toIncludeCss(
241+
css`
242+
.font-bold {
243+
font-weight: BOLD;
244+
}
245+
`
246+
)
247+
})
248+
210249
test('--content', async () => {
211250
await writeInputFile('other.html', html`<div class="font-bold"></div>`)
212251

0 commit comments

Comments
 (0)