Skip to content

Commit

Permalink
chore: Disable vitest globals (#6216)
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlancollins committed Oct 22, 2023
1 parent b5c74f9 commit c014ea7
Show file tree
Hide file tree
Showing 114 changed files with 253 additions and 154 deletions.
1 change: 1 addition & 0 deletions packages/eslint-plugin-query/src/__tests__/configs.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from 'vitest'
import { configs } from '../configs'

describe('configs', () => {
Expand Down
11 changes: 7 additions & 4 deletions packages/eslint-plugin-query/tsconfig.json
@@ -1,7 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["vitest/globals"]
},
"include": ["src/**/*.ts", "src/**/*.tsx", ".eslintrc.cjs", "tsup.config.js"]
"include": [
"src/**/*.ts",
"src/**/*.tsx",
".eslintrc.cjs",
"tsup.config.js",
"vitest.config.ts"
]
}
@@ -1,4 +1,4 @@
import { vi } from 'vitest'
import { describe, expect, test, vi } from 'vitest'
import { asyncThrottle } from '../asyncThrottle'
import { sleep as delay } from './utils'

Expand Down
11 changes: 7 additions & 4 deletions packages/query-async-storage-persister/tsconfig.json
@@ -1,7 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["vitest/globals"]
},
"include": ["src/**/*.ts", "src/**/*.tsx", ".eslintrc.cjs", "tsup.config.js"]
"include": [
"src/**/*.ts",
"src/**/*.tsx",
".eslintrc.cjs",
"tsup.config.js",
"vitest.config.ts"
]
}
1 change: 0 additions & 1 deletion packages/query-async-storage-persister/vitest.config.ts
Expand Up @@ -5,7 +5,6 @@ export default defineConfig({
name: 'query-async-storage-persister',
dir: './src',
watch: false,
globals: true,
coverage: { provider: 'istanbul' },
},
})
2 changes: 1 addition & 1 deletion packages/query-core/src/tests/focusManager.test.tsx
@@ -1,4 +1,4 @@
import { vi } from 'vitest'
import { beforeEach, describe, expect, it, test, vi } from 'vitest'
import { sleep } from '../utils'
import { FocusManager } from '../focusManager'
import { setIsServer } from './utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/src/tests/hydration.test.tsx
@@ -1,4 +1,4 @@
import { expect, vi } from 'vitest'
import { describe, expect, test, vi } from 'vitest'
import { QueryCache } from '../queryCache'
import { dehydrate, hydrate } from '../hydration'
import { MutationCache } from '../mutationCache'
Expand Down
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
import { waitFor } from '@testing-library/react'
import { vi } from 'vitest'
import { CancelledError, InfiniteQueryObserver } from '..'
import { createQueryClient, queryKey, sleep } from './utils'
import type { InfiniteQueryObserverResult, QueryCache, QueryClient } from '..'
Expand Down
@@ -1,4 +1,4 @@
import { expect, vi } from 'vitest'
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
import { InfiniteQueryObserver } from '..'
import { createQueryClient, queryKey, sleep } from './utils'
import type { QueryClient } from '..'
Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/src/tests/mutationCache.test.tsx
@@ -1,5 +1,5 @@
import { describe, expect, test, vi } from 'vitest'
import { waitFor } from '@testing-library/react'
import { vi } from 'vitest'
import { MutationCache, MutationObserver } from '..'
import { createQueryClient, executeMutation, queryKey, sleep } from './utils'

Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/src/tests/mutationObserver.test.tsx
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
import { waitFor } from '@testing-library/react'
import { vi } from 'vitest'
import { MutationObserver } from '..'
import { createQueryClient, sleep } from './utils'
import type { QueryClient } from '..'
Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/src/tests/mutations.test.tsx
@@ -1,4 +1,4 @@
import { vi } from 'vitest'
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
import { waitFor } from '@testing-library/react'
import { MutationObserver } from '../mutationObserver'
import { createQueryClient, executeMutation, queryKey, sleep } from './utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/src/tests/notifyManager.test.tsx
@@ -1,4 +1,4 @@
import { vi } from 'vitest'
import { describe, expect, it, vi } from 'vitest'
import { createNotifyManager } from '../notifyManager'
import { sleep } from './utils'

Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/src/tests/onlineManager.test.tsx
@@ -1,4 +1,4 @@
import { vi } from 'vitest'
import { beforeEach, describe, expect, test, vi } from 'vitest'
import { OnlineManager } from '../onlineManager'
import { setIsServer, sleep } from './utils'

Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/src/tests/queriesObserver.test.tsx
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
import { waitFor } from '@testing-library/react'
import { vi } from 'vitest'
import { QueriesObserver } from '..'
import { createQueryClient, queryKey, sleep } from './utils'
import type { QueryClient, QueryObserverResult } from '..'
Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/src/tests/query.test.tsx
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, test, vi } from 'vitest'
import { waitFor } from '@testing-library/react'
import { vi } from 'vitest'
import { QueryObserver, isCancelledError, onlineManager } from '..'
import {
createQueryClient,
Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/src/tests/queryCache.test.tsx
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
import { waitFor } from '@testing-library/react'
import { vi } from 'vitest'
import { QueryCache, QueryClient, QueryObserver } from '..'
import { createQueryClient, queryKey, sleep } from './utils'

Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/src/tests/queryClient.test.tsx
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
import { waitFor } from '@testing-library/react'
import '@testing-library/jest-dom/vitest'

import {
MutationObserver,
Expand Down
1 change: 1 addition & 0 deletions packages/query-core/src/tests/queryClient.types.test.tsx
@@ -1,3 +1,4 @@
import { describe, it } from 'vitest'
import { QueryClient } from '../queryClient'
import { doNotExecute } from './utils'
import type { Equal, Expect } from './utils'
Expand Down
10 changes: 9 additions & 1 deletion packages/query-core/src/tests/queryObserver.test.tsx
@@ -1,4 +1,12 @@
import { vi } from 'vitest'
import {
afterEach,
beforeEach,
describe,
expect,
expectTypeOf,
test,
vi,
} from 'vitest'
import { QueryObserver, focusManager } from '..'
import { createQueryClient, queryKey, sleep } from './utils'
import type { QueryClient, QueryObserverResult } from '..'
Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/src/tests/utils.test.tsx
@@ -1,4 +1,4 @@
import { vi } from 'vitest'
import { describe, expect, it, vi } from 'vitest'
import {
addToEnd,
addToStart,
Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/src/tests/utils.ts
@@ -1,5 +1,5 @@
import { act } from '@testing-library/react'
import { vi } from 'vitest'
import { act } from '@testing-library/react'
import { QueryClient, onlineManager } from '..'
import * as utils from '../utils'
import type { SpyInstance } from 'vitest'
Expand Down
11 changes: 7 additions & 4 deletions packages/query-core/tsconfig.json
@@ -1,7 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["vitest/globals"]
},
"include": ["src/**/*.ts", "src/**/*.tsx", ".eslintrc.cjs", "tsup.config.js"]
"include": [
"src/**/*.ts",
"src/**/*.tsx",
".eslintrc.cjs",
"tsup.config.js",
"vitest.config.ts"
]
}
1 change: 0 additions & 1 deletion packages/query-core/vitest.config.ts
Expand Up @@ -6,7 +6,6 @@ export default defineConfig({
dir: './src',
watch: false,
environment: 'jsdom',
globals: true,
coverage: { provider: 'istanbul' },
},
})
2 changes: 2 additions & 0 deletions packages/query-devtools/src/__tests__/devtools.test.tsx
@@ -1,3 +1,5 @@
import { describe, expect, it } from 'vitest'

describe('ReactQueryDevtools', () => {
it('should be able to open and close devtools', async () => {
expect(1).toBe(1)
Expand Down
1 change: 1 addition & 0 deletions packages/query-devtools/src/__tests__/utils.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from 'vitest'
import { deleteNestedDataByPath, updateNestedDataByPath } from '../utils'

describe('Utils tests', () => {
Expand Down
11 changes: 8 additions & 3 deletions packages/query-devtools/tsconfig.json
Expand Up @@ -2,8 +2,13 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
"jsxImportSource": "solid-js",
"types": ["vitest/globals"]
"jsxImportSource": "solid-js"
},
"include": ["src/**/*.ts", "src/**/*.tsx", ".eslintrc.cjs", "tsup.config.js"]
"include": [
"src/**/*.ts",
"src/**/*.tsx",
".eslintrc.cjs",
"tsup.config.js",
"vitest.config.ts"
]
}
2 changes: 0 additions & 2 deletions packages/query-devtools/vitest.config.ts
Expand Up @@ -6,9 +6,7 @@ export default defineConfig({
name: 'query-devtools',
dir: './src',
watch: false,
setupFiles: [],
environment: 'jsdom',
globals: true,
coverage: { provider: 'istanbul' },
},
plugins: [solid()],
Expand Down
@@ -1,5 +1,5 @@
import { describe, expect, test, vi } from 'vitest'
import { Query, QueryCache, hashKey } from '@tanstack/query-core'
import { vi } from 'vitest'
import {
PERSISTER_KEY_PREFIX,
experimental_createPersister,
Expand Down
@@ -1,5 +1,5 @@
import { describe, expect, test, vi } from 'vitest'
import { QueriesObserver } from '@tanstack/query-core'
import { vi } from 'vitest'
import { persistQueryClientSubscribe } from '../persist'
import {
createMockPersister,
Expand Down
2 changes: 1 addition & 1 deletion packages/query-persist-client-core/src/__tests__/utils.ts
@@ -1,5 +1,5 @@
import { QueryClient } from '@tanstack/query-core'
import { vi } from 'vitest'
import { QueryClient } from '@tanstack/query-core'
import type { QueryClientConfig } from '@tanstack/query-core'
import type { PersistedClient, Persister } from '../persist'

Expand Down
11 changes: 7 additions & 4 deletions packages/query-persist-client-core/tsconfig.json
@@ -1,7 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["vitest/globals"]
},
"include": ["src/**/*.ts", "src/**/*.tsx", ".eslintrc.cjs", "tsup.config.js"]
"include": [
"src/**/*.ts",
"src/**/*.tsx",
".eslintrc.cjs",
"tsup.config.js",
"vitest.config.ts"
]
}
1 change: 0 additions & 1 deletion packages/query-persist-client-core/vitest.config.ts
Expand Up @@ -5,7 +5,6 @@ export default defineConfig({
name: 'query-persist-client-core',
dir: './src',
watch: false,
globals: true,
coverage: { provider: 'istanbul' },
},
})
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import {
MutationCache,
QueryCache,
Expand Down
11 changes: 7 additions & 4 deletions packages/query-sync-storage-persister/tsconfig.json
@@ -1,7 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["vitest/globals"]
},
"include": ["src/**/*.ts", "src/**/*.tsx", ".eslintrc.cjs", "tsup.config.js"]
"include": [
"src/**/*.ts",
"src/**/*.tsx",
".eslintrc.cjs",
"tsup.config.js",
"vitest.config.ts"
]
}
1 change: 0 additions & 1 deletion packages/query-sync-storage-persister/vitest.config.ts
Expand Up @@ -5,7 +5,6 @@ export default defineConfig({
name: 'query-sync-storage-persister',
dir: './src',
watch: false,
globals: true,
coverage: { provider: 'istanbul' },
},
})
2 changes: 2 additions & 0 deletions packages/react-query-devtools/src/__tests__/devtools.test.tsx
@@ -1,3 +1,5 @@
import { describe, expect, it } from 'vitest'

describe('ReactQueryDevtools', () => {
it('should be able to open and close devtools', async () => {
expect(1).toBe(1)
Expand Down
7 changes: 6 additions & 1 deletion packages/react-query-devtools/test-setup.ts
@@ -1,6 +1,11 @@
import { act } from '@testing-library/react'
import '@testing-library/jest-dom/vitest'
import { act, cleanup } from '@testing-library/react'
import { afterEach } from 'vitest'
import { notifyManager } from '@tanstack/react-query'

// https://testing-library.com/docs/react-testing-library/api#cleanup
afterEach(() => cleanup())

// Wrap notifications with act to make sure React knows about React Query updates
notifyManager.setNotifyFunction((fn) => {
act(fn)
Expand Down
12 changes: 9 additions & 3 deletions packages/react-query-devtools/tsconfig.json
@@ -1,8 +1,14 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"jsx": "react",
"types": ["vitest/globals"]
"jsx": "react"
},
"include": ["src/**/*.ts", "src/**/*.tsx", ".eslintrc.cjs", "tsup.config.js"]
"include": [
"src/**/*.ts",
"src/**/*.tsx",
".eslintrc.cjs",
"test-setup.ts",
"tsup.config.js",
"vitest.config.ts"
]
}
1 change: 0 additions & 1 deletion packages/react-query-devtools/vitest.config.ts
Expand Up @@ -7,7 +7,6 @@ export default defineConfig({
watch: false,
setupFiles: ['test-setup.ts'],
environment: 'jsdom',
globals: true,
coverage: { provider: 'istanbul' },
},
})
7 changes: 6 additions & 1 deletion packages/react-query-next-experimental/test-setup.ts
@@ -1,6 +1,11 @@
import { act } from '@testing-library/react'
import '@testing-library/jest-dom/vitest'
import { act, cleanup } from '@testing-library/react'
import { afterEach } from 'vitest'
import { notifyManager } from '@tanstack/react-query'

// https://testing-library.com/docs/react-testing-library/api#cleanup
afterEach(() => cleanup())

// Wrap notifications with act to make sure React knows about React Query updates
notifyManager.setNotifyFunction((fn) => {
act(fn)
Expand Down
12 changes: 9 additions & 3 deletions packages/react-query-next-experimental/tsconfig.json
@@ -1,8 +1,14 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"jsx": "react",
"types": ["vitest/globals"]
"jsx": "react"
},
"include": ["src/**/*.ts", "src/**/*.tsx", ".eslintrc.cjs", "tsup.config.js"]
"include": [
"src/**/*.ts",
"src/**/*.tsx",
".eslintrc.cjs",
"test-setup.ts",
"tsup.config.js",
"vitest.config.ts"
]
}
1 change: 0 additions & 1 deletion packages/react-query-next-experimental/vitest.config.ts
Expand Up @@ -7,7 +7,6 @@ export default defineConfig({
watch: false,
setupFiles: ['test-setup.ts'],
environment: 'jsdom',
globals: true,
coverage: { provider: 'istanbul' },
},
})
@@ -1,7 +1,6 @@
import { describe, expect, test, vi } from 'vitest'
import * as React from 'react'
import { fireEvent, render, waitFor } from '@testing-library/react'
import { vi } from 'vitest'

import { QueryClient, useQueries, useQuery } from '@tanstack/react-query'
import { persistQueryClientSave } from '@tanstack/query-persist-client-core'

Expand Down
1 change: 0 additions & 1 deletion packages/react-query-persist-client/src/__tests__/utils.ts
@@ -1,5 +1,4 @@
import { act } from '@testing-library/react'

import { QueryClient } from '@tanstack/react-query'
import type { QueryClientConfig } from '@tanstack/react-query'

Expand Down

0 comments on commit c014ea7

Please sign in to comment.