We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a113a2d commit 2794bc8Copy full SHA for 2794bc8
src/core/definePage.spec.ts
@@ -153,6 +153,24 @@ definePage({
153
expect(result?.code).toMatchInlineSnapshot()
154
})
155
156
+ it('throws if definePage uses a variable from the setup', async () => {
157
+ const code = `
158
+<script setup>
159
+const a = 1
160
+definePage({
161
+ name: a,
162
+})
163
+</script>
164
+`
165
+ // the function syntax works with sync and async errors
166
+ await expect(async () => {
167
+ await definePageTransform({
168
+ code,
169
+ id: 'src/pages/basic.vue&definePage&vue',
170
+ })
171
+ }).rejects.toThrowError()
172
173
+
174
it('extracts name and path', async () => {
175
expect(
176
await extractDefinePageNameAndPath(sampleCode, 'src/pages/basic.vue')
0 commit comments