Skip to content

Commit e6bb3b9

Browse files
committed
test: add
1 parent 3385107 commit e6bb3b9

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

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

+15
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,21 @@ return () => {}
12771277
}"
12781278
`;
12791279

1280+
exports[`SFC compile <script setup> > should compile JS syntax 1`] = `
1281+
"const a = 1
1282+
const b = 2
1283+
1284+
export default {
1285+
setup(__props, { expose }) {
1286+
expose();
1287+
1288+
1289+
return { a, b }
1290+
}
1291+
1292+
}"
1293+
`;
1294+
12801295
exports[`SFC compile <script setup> > should expose top level declarations 1`] = `
12811296
"import { x } from './x'
12821297

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

+11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ 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+
</script>
11+
`)
12+
expect(content).toMatch(`return { a, b }`)
13+
assertCode(content)
14+
})
15+
516
test('should expose top level declarations', () => {
617
const { content, bindings } = compile(`
718
<script setup>

0 commit comments

Comments
 (0)