Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/vue-query-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"compile": "vue-tsc --build",
"test:eslint": "eslint --concurrency=auto ./src",
"test:types": "vue-tsc --build",
"test:lib": "vitest",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict && attw --pack",
"build": "pnpm run compile && vite build"
},
Expand Down
16 changes: 16 additions & 0 deletions packages/vue-query-devtools/src/__tests__/VueQueryDevtools.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { describe, expect, it, vi } from 'vitest'

describe('VueQueryDevtools', () => {
it('should return null in non-development environments', async () => {
vi.stubEnv('NODE_ENV', 'production')
vi.resetModules()

try {
const { VueQueryDevtools } = await import('..')
expect((VueQueryDevtools as unknown as () => null)()).toBeNull()
} finally {
vi.unstubAllEnvs()
vi.resetModules()
}
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { describe, expect, it, vi } from 'vitest'

describe('VueQueryDevtoolsPanel', () => {
it('should return null in non-development environments', async () => {
vi.stubEnv('NODE_ENV', 'production')
vi.resetModules()

try {
const { VueQueryDevtoolsPanel } = await import('..')
expect((VueQueryDevtoolsPanel as unknown as () => null)()).toBeNull()
} finally {
vi.unstubAllEnvs()
vi.resetModules()
}
})
})
18 changes: 17 additions & 1 deletion packages/vue-query-devtools/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { defineConfig, mergeConfig } from 'vite'
import { defineConfig, mergeConfig } from 'vitest/config'
import vue from '@vitejs/plugin-vue'
import { tanstackViteConfig } from '@tanstack/vite-config'

import packageJson from './package.json'

const config = defineConfig({
plugins: [vue()],
// fix from https://github.com/vitest-dev/vitest/issues/6992#issuecomment-2509408660
Expand All @@ -15,6 +17,20 @@ const config = defineConfig({
},
},
},
test: {
name: packageJson.name,
dir: './src',
watch: false,
environment: 'jsdom',
coverage: {
enabled: true,
provider: 'istanbul',
include: ['src/**/*'],
exclude: ['src/__tests__/**'],
},
typecheck: { enabled: true },
restoreMocks: true,
},
})

export default mergeConfig(
Expand Down
Loading