Skip to content

Commit 91723ac

Browse files
committedSep 27, 2023
style: lint
1 parent 8da186c commit 91723ac

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed
 

‎src/vitest-environment-nuxt/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default <Environment>{
6161
}
6262

6363
const h3App = createApp()
64-
64+
6565
if (!win.fetch) {
6666
await import('node-fetch-native/polyfill')
6767
// @ts-expect-error URLSearchParams is not a proeprty of window

‎src/vitest-environment-nuxt/runtime/render.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import {
55
h,
66
nextTick,
77
} from 'vue'
8-
import type {
9-
RenderOptions as TestingLibraryRenderOptions,
10-
} from '@testing-library/vue'
8+
import type { RenderOptions as TestingLibraryRenderOptions } from '@testing-library/vue'
119
import { defu } from 'defu'
1210
import type { RouteLocationRaw } from 'vue-router'
1311

@@ -66,7 +64,9 @@ export async function renderSuspended<T>(
6664
..._options
6765
} = options || {}
6866

69-
const { render : renderFromTestingLibrary } = await import('@testing-library/vue')
67+
const { render: renderFromTestingLibrary } = await import(
68+
'@testing-library/vue'
69+
)
7070

7171
// @ts-ignore untyped global __unctx__
7272
const { vueApp } = globalThis.__unctx__.get('nuxt-app').tryUse()

‎test/fixtures/nuxt-vitest/tests/nuxt/index.spec.ts

+16-10
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,20 @@ describe('client-side nuxt features', () => {
3939

4040
it('allows pushing to other pages', async () => {
4141
await navigateTo('/something')
42-
expect(useNuxtApp().$router.currentRoute.value.path).toEqual(
43-
'/something'
44-
)
42+
expect(useNuxtApp().$router.currentRoute.value.path).toEqual('/something')
4543
// It takes a few ticks for the Nuxt useRoute to be updated (as, after suspense resolves,
4644
// we wait for a final hook and then update the injected route object )
4745
const route = useRoute()
4846
await new Promise<void>(resolve => {
49-
const unsub = watch(() => route.path, path => {
50-
if (path === '/something') {
51-
unsub()
52-
resolve()
47+
const unsub = watch(
48+
() => route.path,
49+
path => {
50+
if (path === '/something') {
51+
unsub()
52+
resolve()
53+
}
5354
}
54-
})
55+
)
5556
})
5657
expect(route.path).toEqual('/something')
5758
})
@@ -115,10 +116,15 @@ describe('test utils', () => {
115116
})
116117

117118
it('can use $fetch', async () => {
118-
const app = createApp().use('/todos/1', eventHandler(() => ({ id: 1 })))
119+
const app = createApp().use(
120+
'/todos/1',
121+
eventHandler(() => ({ id: 1 }))
122+
)
119123
const server = await listen(toNodeListener(app))
120124
const [{ url }] = await server.getURLs()
121-
expect(await $fetch<unknown>('/todos/1', { baseURL: url })).toMatchObject({ id: 1 })
125+
expect(await $fetch<unknown>('/todos/1', { baseURL: url })).toMatchObject({
126+
id: 1,
127+
})
122128
await server.close()
123129
})
124130

0 commit comments

Comments
 (0)
Please sign in to comment.