Skip to content

Commit

Permalink
chore(ui): fix static ui client types (#7201)
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin authored Jan 12, 2025
1 parent 50cf61b commit a942ea7
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ test/browser/fixtures/update-snapshot/basic.test.ts
test/cli/fixtures/browser-multiple/basic-*
.vitest-reports
*.tsbuildinfo
# exclude static html reporter folder
test/browser/html/
test/core/html/
3 changes: 2 additions & 1 deletion packages/ui/client/composables/client/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export function createStaticClient(): VitestClient {
onTaskUpdate: noop,
writeFile: asyncNoop,
rerun: asyncNoop,
rerunTask: asyncNoop,
updateSnapshot: asyncNoop,
resolveSnapshotPath: asyncNoop,
snapshotSaved: asyncNoop,
Expand All @@ -80,7 +81,7 @@ export function createStaticClient(): VitestClient {

ctx.rpc = rpc as any as BirpcReturn<WebSocketHandlers, WebSocketEvents>

let openPromise: Promise<void>
const openPromise = Promise.resolve()

function reconnect() {
registerMetadata()
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/client/composables/explorer/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function useSearch(searchBox: Ref<HTMLDivElement | undefined>) {
const disableClearSearch = computed(() => search.value === '')
const debouncedSearch = ref(search.value)

debouncedWatch(search, (value) => {
debouncedWatch(() => search.value, (value) => {
debouncedSearch.value = value?.trim() ?? ''
}, { debounce: 256 })

Expand Down
7 changes: 4 additions & 3 deletions packages/ui/client/global-setup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// <reference types="vite-plugin-pages/client" />

import FloatingVue, { VTooltip } from 'floating-vue'
import type { Directive } from 'vue'
import FloatingVue, { vTooltip } from 'floating-vue'
import routes from 'virtual:generated-pages'
import {
createRouter as _createRouter,
Expand All @@ -15,8 +16,8 @@ import './styles/main.css'
import 'floating-vue/dist/style.css'
import 'uno.css'

export const directives = {
tooltip: VTooltip,
export const directives: Record<string, Directive> = {
tooltip: vTooltip,
}

FloatingVue.options.instantMove = true
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/client/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import {
cleanup,
type RenderOptions,
} from '@testing-library/vue'
import { VTooltip } from 'floating-vue'
import { vTooltip } from 'floating-vue'
import { afterEach } from 'vitest'

export function render(component: any, options?: RenderOptions) {
export function render<C>(component: C, options?: RenderOptions<C>) {
return _render(component, {
...options,
global: {
directives: {
tooltip: VTooltip,
tooltip: vTooltip,
},
},
})
Expand Down
3 changes: 2 additions & 1 deletion test/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"coverage": "vitest --coverage.enabled --coverage.provider=istanbul --browser.headless=yes",
"test:browser:preview": "PROVIDER=preview vitest",
"test:browser:playwright": "PROVIDER=playwright vitest",
"test:browser:webdriverio": "PROVIDER=webdriverio vitest"
"test:browser:webdriverio": "PROVIDER=webdriverio vitest",
"test:browser:playwright:html": "PROVIDER=playwright vitest --reporter=html"
},
"devDependencies": {
"@testing-library/react": "^13.2.0",
Expand Down
5 changes: 4 additions & 1 deletion test/browser/vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ export default defineConfig({
},
open: false,
diff: './custom-diff-config.ts',
outputFile: './browser.json',
outputFile: {
html: './html/index.html',
json: './browser.json',
},
reporters: ['json', {
onInit: noop,
onPathsCollected: noop,
Expand Down
1 change: 1 addition & 0 deletions test/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"scripts": {
"test": "vitest",
"test:html": "vitest --reporter=html",
"test:threads": "vitest --project threads",
"test:forks": "vitest --project forks",
"test:vmThreads": "vitest --project vmThreads",
Expand Down
1 change: 0 additions & 1 deletion tsconfig.check.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"./packages/vitest/dist/**",
"./packages/*/*.d.ts",
"./packages/*/*.d.cts",
"./packages/ui/client/**",
"./examples/**/*.*",
"./bench/**",
"./test/benchmark/fixtures/**",
Expand Down

0 comments on commit a942ea7

Please sign in to comment.