Skip to content

Commit 7bae15d

Browse files
committed
fix: useRoute fails with no-resolve
1 parent 11404bd commit 7bae15d

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

Diff for: playground/layouts/default.vue

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,18 @@
22
<div>
33
<Nuxt />
44
<hr>
5-
Route: {{ route.path }}
5+
Route: {{ $route.path }}
66
</div>
77
</template>
88

99
<script>
1010
export default {
1111
setup () {
12-
const route = useRoute()
1312
useHead({
1413
titleTemplate (title) {
1514
return `${title} - Nuxt Bridge Playground`
1615
}
1716
})
18-
return { route }
1917
}
2018
}
2119
</script>

Diff for: test/bridge.test.ts

+4-9
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('nuxt composables', () => {
4343
})
4444

4545
// remove after port upstream.
46-
it.skipIf((isWebpack && isNoResolve) || isDev)('updates cookies when they are changed', async () => {
46+
it.skipIf(isDev)('updates cookies when they are changed', async () => {
4747
const { page } = await renderPage('/cookies')
4848
async function extractCookie () {
4949
const cookie = await page.evaluate(() => document.cookie)
@@ -137,9 +137,7 @@ describe('pages', () => {
137137

138138
const { page, consoleLogs } = await renderPage('/')
139139

140-
if (isWebpack && isNoResolve) {
141-
expect(consoleLogs.some(i => i.type === 'error')).toBeTruthy()
142-
} else if (isDev) {
140+
if (isDev) {
143141
// output [legacy capi] warning
144142
expect(consoleLogs.some(i => i.type === 'warning')).toBeTruthy()
145143
} else {
@@ -200,9 +198,7 @@ describe('navigate', () => {
200198

201199
const { page, consoleLogs } = await renderPage('/navigate-to/')
202200

203-
if (isWebpack && isNoResolve) {
204-
expect(consoleLogs.some(i => i.type === 'error')).toBeTruthy()
205-
} else if (isDev) {
201+
if (isDev) {
206202
// output [legacy capi] warning
207203
expect(consoleLogs.some(i => i.type === 'warning')).toBeTruthy()
208204
} else {
@@ -302,8 +298,7 @@ describe('middleware', () => {
302298
expect(html).toContain('Navigated successfully')
303299
})
304300

305-
// if `no-resolve`, an error occurs at `useRoute`.
306-
it.skipIf(isWebpack && isNoResolve)('should be output with target as to and origin as from', async () => {
301+
it('should be output with target as to and origin as from', async () => {
307302
const { page, consoleLogs } = await renderPage('/')
308303
await page.getByRole('link').click()
309304

0 commit comments

Comments
 (0)