-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathremove-wrapper-function.test.ts
More file actions
40 lines (36 loc) · 1.01 KB
/
Copy pathremove-wrapper-function.test.ts
File metadata and controls
40 lines (36 loc) · 1.01 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
import { expect, test } from 'vitest'
import { transform } from '../src/core/transform.ts'
import { RemoveWrapperFunction } from '../src/transformers.ts'
import type { OptionsResolved } from '../src/core/options.ts'
test('remove wrapper function', async () => {
const source = `const comp = defineComponent({
render() {
return []
}
})
console.log(mutable({} as const))
console.log(() => mutable({} as const))
const css = tw\`text-center \${expr}\`
`
const options: Pick<OptionsResolved, 'parserOptions' | 'transformer'> = {
transformer: [
RemoveWrapperFunction([
'defineComponent',
'mutable',
'definePropType',
'tw',
]),
],
parserOptions: {},
}
const code = (await transform(source, 'foo.ts', options))?.toString()
expect(code).toMatchInlineSnapshot(`
"const comp = ({ render() {
return [];
} })
console.log(({} as const))
console.log(() => ({} as const))
const css = \`text-center \${expr}\`
"
`)
})