Merged in chore/upgrade-vitest4 (pull request #3253)

chore: upgrade to vitest@4

* chore: upgrade to vitest@4


Approved-by: Anton Gunnarsson
This commit is contained in:
Joakim Jäderberg
2025-12-01 12:41:12 +00:00
parent 3ec78b4fab
commit f5dd6740d0
13 changed files with 241 additions and 191 deletions

View File

@@ -88,14 +88,14 @@
"@types/react": "^19.2.3",
"@typescript-eslint/eslint-plugin": "^8.32.0",
"@typescript-eslint/parser": "^8.32.0",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/coverage-v8": "^4.0.0",
"dotenv": "^16.5.0",
"eslint": "^9",
"eslint-plugin-formatjs": "^5.3.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"typescript": "5.8.3",
"vitest": "^3.2.4",
"vitest": "^4.0.0",
"zod": "^3.24.4"
}
}

View File

@@ -96,7 +96,7 @@
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"typescript": "5.8.3",
"vitest": "^3.2.4"
"vitest": "^4.0.0"
},
"prettier": {
"semi": false,

View File

@@ -1,9 +1,11 @@
import path from "path"
import { fileURLToPath } from "url"
import { defineConfig } from "vitest/config"
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
export default {
export default defineConfig({
test: {
globals: true,
environment: "jsdom",
@@ -14,4 +16,4 @@ export default {
"@": path.resolve(__dirname, "."),
},
},
}
})

View File

@@ -262,7 +262,8 @@
"@typescript-eslint/eslint-plugin": "^8.32.0",
"@typescript-eslint/parser": "^8.32.0",
"@vitejs/plugin-react": "^5.1.1",
"@vitest/browser": "^3.2.4",
"@vitest/browser": "^4.0.0",
"@vitest/browser-playwright": "^4.0.0",
"babel-plugin-formatjs": "^10.5.10",
"class-variance-authority": "^0.7.1",
"colord": "^2.9.3",
@@ -291,7 +292,7 @@
"vite": "^7.2.4",
"vite-plugin-dts": "^4.5.4",
"vite-plugin-lib-inject-css": "^2.2.2",
"vitest": "^3.2.4",
"vitest": "^4.0.0",
"vitest-browser-react": "^1.0.1"
}
}

View File

@@ -1,5 +1,6 @@
import { defineConfig, mergeConfig } from 'vitest/config'
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin'
import { playwright } from '@vitest/browser-playwright'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
@@ -13,8 +14,12 @@ import viteConfig from './vite.config'
const isCI = process.env.CI === 'true'
const browserInstances = isCI
? [{ browser: 'chromium' }]
: [{ browser: 'chromium' }, { browser: 'firefox' }, { browser: 'webkit' }]
? [{ browser: 'chromium' as const }]
: [
{ browser: 'chromium' as const },
{ browser: 'firefox' as const },
{ browser: 'webkit' as const },
]
export default mergeConfig(
viteConfig,
@@ -43,7 +48,7 @@ export default mergeConfig(
browser: {
enabled: true,
// Make sure to install Playwright
provider: 'playwright',
provider: playwright(),
headless: true,
instances: browserInstances,
},

View File

@@ -35,7 +35,7 @@
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"typescript": "5.8.3",
"vitest": "^3.2.4"
"vitest": "^4.0.0"
},
"prettier": {
"semi": false,

View File

@@ -3,13 +3,12 @@ import "server-only"
import deepmerge from "deepmerge"
import merge from "deepmerge"
import type { DocumentNode } from "graphql"
import { createLogger } from "@scandic-hotels/common/logger/createLogger"
import { request } from "./request"
import type { CacheTime } from "@scandic-hotels/common/dataCache"
import type { DocumentNode } from "graphql"
import type { BatchRequestDocument } from "graphql-request"
import type { Data } from "../types/requestData"

View File

@@ -85,6 +85,6 @@
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"typescript": "5.8.3",
"vitest": "^3.2.4"
"vitest": "^4.0.0"
}
}

View File

@@ -1,7 +1,9 @@
export default {
import { defineConfig } from "vitest/config"
export default defineConfig({
test: {
globals: true,
environment: "jsdom",
setupFiles: ["./vitest-setup.ts"],
},
}
})