Skip to content

Commit

Permalink
fix: useRoute fails with no-resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
wattanx committed Jul 7, 2024
1 parent a64a630 commit 12a5811
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
4 changes: 1 addition & 3 deletions playground/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@
<div>
<Nuxt />
<hr>
Route: {{ route.path }}
Route: {{ $route.path }}
</div>
</template>

<script>
export default {
setup () {
const route = useRoute()
useHead({
titleTemplate (title) {
return `${title} - Nuxt Bridge Playground`
}
})
return { route }
}
}
</script>
13 changes: 4 additions & 9 deletions test/bridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('nuxt composables', () => {
})

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

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

if (isWebpack && isNoResolve) {
expect(consoleLogs.some(i => i.type === 'error')).toBeTruthy()
} else if (isDev) {
if (isDev) {
// output [legacy capi] warning
expect(consoleLogs.some(i => i.type === 'warning')).toBeTruthy()
} else {
Expand Down Expand Up @@ -200,9 +198,7 @@ describe('navigate', () => {

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

if (isWebpack && isNoResolve) {
expect(consoleLogs.some(i => i.type === 'error')).toBeTruthy()
} else if (isDev) {
if (isDev) {
// output [legacy capi] warning
expect(consoleLogs.some(i => i.type === 'warning')).toBeTruthy()
} else {
Expand Down Expand Up @@ -302,8 +298,7 @@ describe('middleware', () => {
expect(html).toContain('Navigated successfully')
})

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

Expand Down

0 comments on commit 12a5811

Please sign in to comment.