-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtransform.test.ts
More file actions
48 lines (46 loc) · 1.28 KB
/
transform.test.ts
File metadata and controls
48 lines (46 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { resolve } from 'node:path'
import { rolldownBuild, rollupBuild, testFixtures } from '@sxzz/test-utils'
import css from 'rollup-plugin-css-only'
import { describe, expect, it } from 'vitest'
import LightningCSS from '../src/rollup'
describe.each(['rollup', 'rolldown'] as const)('%s transform', async (type) => {
await testFixtures(
['tests/fixtures/*.css'],
async (args, id) =>
(
await (type === 'rollup' ? rollupBuild : rolldownBuild)(id, [
LightningCSS({
options: {
minify: true,
targets: {
ie: 11,
},
},
asString: id.includes('as-string'),
}),
type === 'rollup' && css(),
])
).snapshot,
{ cwd: resolve(__dirname, '..'), promise: true },
)
})
describe('CSS Modules', () => {
it('should transform CSS Modules', async () => {
const entry = resolve(__dirname, './css-module-fixture/index.js')
const { snapshot } = await rollupBuild(entry, [
LightningCSS({
options: {
minify: true,
targets: {
ie: 11,
},
cssModules: {
pattern: 'dummy_[local]',
},
},
}),
css(),
])
expect(snapshot).toMatchSnapshot()
})
})