Skip to content

Commit ddc6e1d

Browse files
committed
test: add test for purge being explicitly disabled
1 parent 9863723 commit ddc6e1d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

__tests__/purgeUnusedStyles.test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,30 @@ test('does not purge if the array is empty', () => {
149149
})
150150
})
151151

152+
test('does not purge if explicitly disabled', () => {
153+
const OLD_NODE_ENV = process.env.NODE_ENV
154+
process.env.NODE_ENV = 'production'
155+
const inputPath = path.resolve(`${__dirname}/fixtures/tailwind-input.css`)
156+
const input = fs.readFileSync(inputPath, 'utf8')
157+
158+
return postcss([
159+
tailwind({
160+
...defaultConfig,
161+
purge: { enabled: false },
162+
}),
163+
])
164+
.process(input, { from: inputPath })
165+
.then(result => {
166+
process.env.NODE_ENV = OLD_NODE_ENV
167+
const expected = fs.readFileSync(
168+
path.resolve(`${__dirname}/fixtures/tailwind-output.css`),
169+
'utf8'
170+
)
171+
172+
expect(result.css).toBe(expected)
173+
})
174+
})
175+
152176
test('purges outside of production if explicitly enabled', () => {
153177
const OLD_NODE_ENV = process.env.NODE_ENV
154178
process.env.NODE_ENV = 'development'

0 commit comments

Comments
 (0)