Skip to content

Commit c8080aa

Browse files
committed
test: add
1 parent b2c3b6d commit c8080aa

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap

+15
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,21 @@ return () => {}
12611261
}"
12621262
`;
12631263

1264+
exports[`SFC compile <script setup> > should compile JS syntax 1`] = `
1265+
"export default {
1266+
setup(__props, { expose }) {
1267+
expose();
1268+
1269+
const a = 1
1270+
const b = 2
1271+
const c = 3
1272+
1273+
return { a, b, c }
1274+
}
1275+
1276+
}"
1277+
`;
1278+
12641279
exports[`SFC compile <script setup> > should expose top level declarations 1`] = `
12651280
"import { x } from './x'
12661281

packages/compiler-sfc/__tests__/compileScript.spec.ts

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ import { BindingTypes } from '@vue/compiler-core'
22
import { compileSFCScript as compile, assertCode, mockId } from './utils'
33

44
describe('SFC compile <script setup>', () => {
5+
test('should compile JS syntax', () => {
6+
const { content } = compile(`
7+
<script setup lang='js'>
8+
const a = 1
9+
const b = 2
10+
const c = 3
11+
</script>
12+
`)
13+
expect(content).toMatch(`return { a, b, c }`)
14+
assertCode(content)
15+
})
16+
517
test('should expose top level declarations', () => {
618
const { content, bindings } = compile(`
719
<script setup>

0 commit comments

Comments
 (0)