refactor: use refTransform instead of deprecated refSugar (#4957)

This commit is contained in:
Cédric Exbrayat 2021-11-25 10:39:36 +01:00 committed by GitHub
parent c6cd6a7938
commit c17cbdc28f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -292,7 +292,7 @@ defineExpose({ foo: 123 })
let foo = $ref(1)
</script>
`,
{ refSugar: true }
{ refTransform: true }
)
assertCode(content)
expect(content).toMatch(`import { ref } from 'vue'`)
@ -1090,7 +1090,7 @@ const emit = defineEmits(['a', 'b'])
describe('async/await detection', () => {
function assertAwaitDetection(code: string, shouldAsync = true) {
const { content } = compile(`<script setup>${code}</script>`, {
refSugar: true
refTransform: true
})
if (shouldAsync) {
expect(content).toMatch(`let __temp, __restore`)

View File

@ -5,7 +5,7 @@ import { compileSFCScript as compile, assertCode } from './utils'
// transform can be found in <root>/packages/ref-transform/__tests__
describe('sfc ref transform', () => {
function compileWithRefTransform(src: string) {
return compile(src, { refSugar: true })
return compile(src, { refTransform: true })
}
test('$ unwrapping', () => {
@ -156,7 +156,7 @@ describe('sfc ref transform', () => {
bar
})
</script>`,
{ refSugar: true }
{ refTransform: true }
)
).toThrow(`cannot reference locally declared variables`)
@ -168,7 +168,7 @@ describe('sfc ref transform', () => {
bar
})
</script>`,
{ refSugar: true }
{ refTransform: true }
)
).toThrow(`cannot reference locally declared variables`)
})