build: upgrade vite to 5.4.x, vitest to 2.x and related vite packages (#8459)

* build: upgrade vite to 5.x, vitest to 2.x and related vite packages

* upgrade vitest-ui and coverage

* pass empty set to fix type error and update snap

* set ignoreEmptyLines to false

* update threshold

* update coverage threshold

* downgrade vite-plugin-pwa as its better to push separately with testing

* add package resolutions for strip-ansi, string-width and wrap-ansi

* disable pwa

* only add resolution for strip-ansi
pull/8471/head
Aakansha Doshi 5 months ago committed by GitHub
parent 21fff26d31
commit 51ea184938
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -21,8 +21,8 @@
"@types/react-dom": "18.2.0", "@types/react-dom": "18.2.0",
"@types/socket.io-client": "3.0.0", "@types/socket.io-client": "3.0.0",
"@vitejs/plugin-react": "3.1.0", "@vitejs/plugin-react": "3.1.0",
"@vitest/coverage-v8": "0.33.0", "@vitest/coverage-v8": "2.0.5",
"@vitest/ui": "0.32.2", "@vitest/ui": "2.0.5",
"chai": "4.3.6", "chai": "4.3.6",
"dotenv": "16.0.1", "dotenv": "16.0.1",
"eslint-config-prettier": "8.5.0", "eslint-config-prettier": "8.5.0",
@ -36,13 +36,13 @@
"prettier": "2.6.2", "prettier": "2.6.2",
"rewire": "6.0.0", "rewire": "6.0.0",
"typescript": "4.9.4", "typescript": "4.9.4",
"vite": "5.0.12", "vite": "5.4.2",
"vite-plugin-checker": "0.6.1", "vite-plugin-checker": "0.7.2",
"vite-plugin-ejs": "1.7.0", "vite-plugin-ejs": "1.7.0",
"vite-plugin-pwa": "0.17.4", "vite-plugin-pwa": "0.17.4",
"vite-plugin-svgr": "2.4.0", "vite-plugin-svgr": "4.2.0",
"vitest": "1.6.0", "vitest": "2.0.5",
"vitest-canvas-mock": "0.3.2" "vitest-canvas-mock": "0.3.3"
}, },
"engines": { "engines": {
"node": "18.0.0 - 20.x.x" "node": "18.0.0 - 20.x.x"
@ -83,6 +83,7 @@
"clean-install": "yarn rm:node_modules && yarn install" "clean-install": "yarn rm:node_modules && yarn install"
}, },
"resolutions": { "resolutions": {
"@types/react": "18.2.0" "@types/react": "18.2.0",
"strip-ansi": "6.0.1"
} }
} }

@ -43,7 +43,7 @@ describe("event callbacks", () => {
// files // files
{}, {},
); );
expect(onChange.mock.lastCall[1].viewBackgroundColor).not.toBe( expect(onChange.mock?.lastCall?.[1].viewBackgroundColor).not.toBe(
origBackgroundColor, origBackgroundColor,
); );
}); });

File diff suppressed because one or more lines are too long

@ -76,7 +76,7 @@ vi.mock(
const url = this.urls[0]; const url = this.urls[0];
if (url.protocol !== "file:") { if (url.protocol !== "file:") {
return super.getContent(); return super.getContent(new Set());
} }
// read local assets directly, without running a server // read local assets directly, without running a server

@ -2,19 +2,27 @@ import { defineConfig } from "vitest/config";
import { woff2BrowserPlugin } from "./scripts/woff2/woff2-vite-plugins"; import { woff2BrowserPlugin } from "./scripts/woff2/woff2-vite-plugins";
export default defineConfig({ export default defineConfig({
// @ts-ignore //@ts-ignore
plugins: [woff2BrowserPlugin()], plugins: [woff2BrowserPlugin()],
test: { test: {
// Since hooks are running in stack in v2, which means all hooks run serially whereas
// we need to run them in parallel
sequence: {
hooks: 'parallel',
},
setupFiles: ["./setupTests.ts"], setupFiles: ["./setupTests.ts"],
globals: true, globals: true,
environment: "jsdom", environment: "jsdom",
coverage: { coverage: {
reporter: ["text", "json-summary", "json", "html", "lcovonly"], reporter: ["text", "json-summary", "json", "html", "lcovonly"],
// Since v2, it ignores empty lines by default and we need to disable it as it affects the coverage
// Additionally the thresholds also needs to be updated slightly as a result of this change
ignoreEmptyLines: false,
thresholds: { thresholds: {
lines: 70, lines: 66,
branches: 70, branches: 70,
functions: 68, functions: 63,
statements: 70, statements: 66,
}, },
}, },
}, },

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save