tailwindcss/tests/jit/relative-purge-paths.test.js
Brad Cornes 243e8814d8
Resolve purge paths relative to the current working directory (#4655)
* resolve purge paths relative to cwd

* simplify test
2021-06-15 16:37:04 -04:00

34 lines
794 B
JavaScript

import postcss from 'postcss'
import fs from 'fs'
import path from 'path'
import tailwind from '../../src/jit/index.js'
function run(input, config = {}) {
return postcss(tailwind(config)).process(input, {
from: path.resolve(__filename),
})
}
test('relative purge paths', () => {
let config = {
purge: ['./tests/jit/relative-purge-paths.test.html'],
mode: 'jit',
corePlugins: { preflight: false },
theme: {},
plugins: [],
}
let css = `
@tailwind base;
@tailwind components;
@tailwind utilities;
`
return run(css, config).then((result) => {
let expectedPath = path.resolve(__dirname, './relative-purge-paths.test.css')
let expected = fs.readFileSync(expectedPath, 'utf8')
expect(result.css).toMatchFormattedCss(expected)
})
})