Skip to content

Commit

Permalink
chore: Disable vitest globals (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlancollins committed Mar 8, 2024
1 parent 5043212 commit 82fa0e1
Show file tree
Hide file tree
Showing 21 changed files with 212 additions and 328 deletions.
19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,26 @@
},
"namespace": "@tanstack",
"devDependencies": {
"@solidjs/testing-library": "^0.8.5",
"@solidjs/testing-library": "^0.8.6",
"@tanstack/config": "^0.6.0",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.4.3",
"@testing-library/vue": "^7.0.0",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.1",
"@testing-library/user-event": "^14.5.2",
"@testing-library/vue": "^8.0.2",
"@types/eslint": "^8.56.2",
"@types/jest": "^26.0.4",
"@types/node": "^18.19.3",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.0.5",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vitest/coverage-istanbul": "^1.2.2",
"@vitest/coverage-istanbul": "^1.3.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"jsdom": "^23.0.1",
"jsdom": "^24.0.0",
"knip": "^4.6.0",
"nx": "^17.2.8",
"prettier": "^4.0.0-alpha.8",
Expand All @@ -71,8 +70,8 @@
"typescript49": "npm:[email protected]",
"typescript50": "npm:[email protected]",
"typescript51": "npm:[email protected]",
"vite": "^5.1.0",
"vitest": "^1.2.2",
"vite": "^5.1.5",
"vitest": "^1.3.1",
"vue": "^3.3.4"
}
}
1 change: 1 addition & 0 deletions packages/angular-store/src/tests/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import { Component, effect } from '@angular/core'
import { TestBed } from '@angular/core/testing'
import { By } from '@angular/platform-browser'
Expand Down
3 changes: 1 addition & 2 deletions packages/angular-store/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"moduleResolution": "Bundler",
"experimentalDecorators": true,
"types": ["vitest/globals"],
"moduleResolution": "Bundler",
"paths": {
"@tanstack/store": ["../store/src"]
}
Expand Down
1 change: 1 addition & 0 deletions packages/angular-store/tsconfig.legacy.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"experimentalDecorators": true,
"moduleResolution": "Node",
"paths": {
"@tanstack/store": ["../store/src"]
Expand Down
2 changes: 1 addition & 1 deletion packages/angular-store/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const config = defineConfig({
watch: false,
environment: 'jsdom',
setupFiles: ['src/tests/test-setup.ts'],
globals: true,
coverage: { enabled: true, provider: 'istanbul', include: ['src/**/*'] },
typecheck: { enabled: true },
globals: true,
},
})

Expand Down
4 changes: 2 additions & 2 deletions packages/react-store/src/tests/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { describe, expect, it, test, vi } from 'vitest'
import { render, waitFor } from '@testing-library/react'
import '@testing-library/jest-dom'
import * as React from 'react'
import { Store } from '@tanstack/store'
import { useState } from 'react'
import userEvent from '@testing-library/user-event'
import { userEvent } from '@testing-library/user-event'
import { shallow, useStore } from '../index'

const user = userEvent.setup()
Expand Down
6 changes: 6 additions & 0 deletions packages/react-store/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import '@testing-library/jest-dom/vitest'
import { cleanup } from '@testing-library/react'
import { afterEach } from 'vitest'

// https://testing-library.com/docs/react-testing-library/api#cleanup
afterEach(() => cleanup())
9 changes: 7 additions & 2 deletions packages/react-store/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
"compilerOptions": {
"jsx": "react",
"moduleResolution": "Bundler",
"types": ["vitest/globals"],
"paths": {
"@tanstack/store": ["../store/src"]
}
},
"include": ["src/**/*.ts", "src/**/*.tsx", ".eslintrc.cjs", "vite.config.ts"]
"include": [
"src/**/*.ts",
"src/**/*.tsx",
".eslintrc.cjs",
"test-setup.ts",
"vite.config.ts"
]
}
2 changes: 1 addition & 1 deletion packages/react-store/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const config = defineConfig({
dir: './src',
watch: false,
environment: 'jsdom',
globals: true,
setupFiles: ['test-setup.ts'],
coverage: { enabled: true, provider: 'istanbul', include: ['src/**/*'] },
typecheck: { enabled: true },
},
Expand Down
2 changes: 1 addition & 1 deletion packages/solid-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@
},
"devDependencies": {
"solid-js": "^1.7.8",
"vite-plugin-solid": "^2.8.0"
"vite-plugin-solid": "^2.10.1"
}
}
2 changes: 1 addition & 1 deletion packages/solid-store/src/tests/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import { render, renderHook } from '@solidjs/testing-library'
import '@testing-library/jest-dom'
import { Store } from '@tanstack/store'
import { useStore } from '../index'

Expand Down
6 changes: 6 additions & 0 deletions packages/solid-store/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import '@testing-library/jest-dom/vitest'
import { cleanup } from '@solidjs/testing-library'
import { afterEach } from 'vitest'

// https://github.com/solidjs/solid-testing-library
afterEach(() => cleanup())
9 changes: 7 additions & 2 deletions packages/solid-store/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
"jsx": "preserve",
"jsxImportSource": "solid-js",
"moduleResolution": "Bundler",
"types": ["vitest/globals"],
"paths": {
"@tanstack/store": ["../store/src"]
}
},
"include": ["src/**/*.ts", "src/**/*.tsx", ".eslintrc.cjs", "vite.config.ts"]
"include": [
"src/**/*.ts",
"src/**/*.tsx",
".eslintrc.cjs",
"test-setup.ts",
"vite.config.ts"
]
}
9 changes: 1 addition & 8 deletions packages/solid-store/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,10 @@ const config = defineConfig({
name: 'solid-store',
dir: './src',
watch: false,
setupFiles: [],
environment: 'jsdom',
globals: true,
setupFiles: ['test-setup.ts'],
coverage: { enabled: true, provider: 'istanbul', include: ['src/**/*'] },
typecheck: { enabled: true },
server: {
deps: {
// https://github.com/solidjs/solid-testing-library#known-issues
inline: [/solid-js/],
},
},
},
})

Expand Down
3 changes: 1 addition & 2 deletions packages/store/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"moduleResolution": "Bundler",
"types": ["vitest/globals"]
"moduleResolution": "Bundler"
},
"include": ["src/**/*.ts", "src/**/*.tsx", ".eslintrc.cjs", "vite.config.ts"]
}
1 change: 0 additions & 1 deletion packages/store/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const config = defineConfig({
dir: './src',
watch: false,
environment: 'jsdom',
globals: true,
coverage: { enabled: true, provider: 'istanbul', include: ['src/**/*'] },
typecheck: { enabled: true },
},
Expand Down
7 changes: 3 additions & 4 deletions packages/vue-store/src/tests/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// We need to import `h` as it's part of Vue's JSX transform
// @ts-expect-error
import { describe, expect, it, test, vi } from 'vitest'
// @ts-expect-error We need to import `h` as it's part of Vue's JSX transform
import { defineComponent, h } from 'vue-demi'
import { render, waitFor } from '@testing-library/vue'
import '@testing-library/jest-dom'
import { Store } from '@tanstack/store'
import userEvent from '@testing-library/user-event'
import { userEvent } from '@testing-library/user-event'
import { shallow, useStore } from '../index'

const user = userEvent.setup()
Expand Down
6 changes: 6 additions & 0 deletions packages/vue-store/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import '@testing-library/jest-dom/vitest'
import { cleanup } from '@testing-library/vue'
import { afterEach } from 'vitest'

// https://testing-library.com/docs/vue-testing-library/api#cleanup
afterEach(() => cleanup())
2 changes: 1 addition & 1 deletion packages/vue-store/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"jsx": "preserve",
"jsxImportSource": "vue",
"moduleResolution": "Bundler",
"types": ["vitest/globals", "vue/jsx"],
"types": ["vue/jsx"],
"paths": {
"@tanstack/store": ["../store/src"]
}
Expand Down
3 changes: 1 addition & 2 deletions packages/vue-store/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ const config = defineConfig({
dir: './src',
watch: false,
environment: 'jsdom',
globals: true,
setupFiles: [],
setupFiles: ['test-setup.ts'],
coverage: { enabled: true, provider: 'istanbul', include: ['src/**/*'] },
typecheck: { enabled: true },
},
Expand Down
Loading

0 comments on commit 82fa0e1

Please sign in to comment.