소스 검색

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
Aakansha Doshi 11 달 전
부모
커밋
51ea184938
6개의 변경된 파일508개의 추가작업 그리고 154개의 파일을 삭제
  1. 9 8
      package.json
  2. 1 1
      packages/excalidraw/tests/packages/events.test.tsx
  3. 0 0
      packages/excalidraw/tests/scene/__snapshots__/export.test.ts.snap
  4. 1 1
      setupTests.ts
  5. 12 4
      vitest.config.mts
  6. 485 140
      yarn.lock

+ 9 - 8
package.json

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

+ 1 - 1
packages/excalidraw/tests/packages/events.test.tsx

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

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
packages/excalidraw/tests/scene/__snapshots__/export.test.ts.snap


+ 1 - 1
setupTests.ts

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

+ 12 - 4
vitest.config.mts

@@ -2,19 +2,27 @@ import { defineConfig } from "vitest/config";
 import { woff2BrowserPlugin } from "./scripts/woff2/woff2-vite-plugins";
 
 export default defineConfig({
-  // @ts-ignore
+  //@ts-ignore
   plugins: [woff2BrowserPlugin()],
   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"],
     globals: true,
     environment: "jsdom",
     coverage: {
       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: {
-        lines: 70,
+        lines: 66,
         branches: 70,
-        functions: 68,
-        statements: 70,
+        functions: 63,
+        statements: 66,
       },
     },
   },

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 485 - 140
yarn.lock


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.