improve vitest hang (#1470)

* improve vitest hang

* fmt

* make types happy

* fix types

* fix
This commit is contained in:
Kurt Hutten
2024-02-21 13:23:50 +11:00
committed by GitHub
parent cbd26d29fa
commit 0d8804005a
6 changed files with 432 additions and 369 deletions

View File

@ -86,8 +86,6 @@ jobs:
- run: yarn test:nowatch - run: yarn test:nowatch
- run: yarn test:cov
prepare-json-files: prepare-json-files:
runs-on: ubuntu-latest # seperate job on Ubuntu for easy string manipulations (compared to Windows) runs-on: ubuntu-latest # seperate job on Ubuntu for easy string manipulations (compared to Windows)

View File

@ -34,6 +34,7 @@
"fuse.js": "^7.0.0", "fuse.js": "^7.0.0",
"http-server": "^14.1.1", "http-server": "^14.1.1",
"json-rpc-2.0": "^1.6.0", "json-rpc-2.0": "^1.6.0",
"node-fetch": "^3.3.2",
"re-resizable": "^6.9.11", "re-resizable": "^6.9.11",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
@ -51,7 +52,7 @@
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"uuid": "^9.0.1", "uuid": "^9.0.1",
"vitest": "^0.34.6", "vitest": "^1.3.1",
"vscode-jsonrpc": "^8.1.0", "vscode-jsonrpc": "^8.1.0",
"vscode-languageserver-protocol": "^3.17.5", "vscode-languageserver-protocol": "^3.17.5",
"wasm-pack": "^0.12.1", "wasm-pack": "^0.12.1",
@ -72,7 +73,6 @@
"test": "vitest --mode development", "test": "vitest --mode development",
"test:nowatch": "vitest run --mode development", "test:nowatch": "vitest run --mode development",
"test:rust": "(cd src/wasm-lib && cargo test --all && cargo clippy --all --tests --benches)", "test:rust": "(cd src/wasm-lib && cargo test --all && cargo clippy --all --tests --benches)",
"test:cov": "vitest run --coverage --mode development",
"test:e2e:tauri": "E2E_TAURI_ENABLED=true TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' wdio run wdio.conf.ts", "test:e2e:tauri": "E2E_TAURI_ENABLED=true TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' wdio run wdio.conf.ts",
"simpleserver:ci": "yarn pretest && http-server ./public --cors -p 3000 &", "simpleserver:ci": "yarn pretest && http-server ./public --cors -p 3000 &",
"simpleserver": "yarn pretest && http-server ./public --cors -p 3000", "simpleserver": "yarn pretest && http-server ./public --cors -p 3000",
@ -113,7 +113,6 @@
"@tauri-apps/cli": "^1.5.6", "@tauri-apps/cli": "^1.5.6",
"@types/crypto-js": "^4.1.1", "@types/crypto-js": "^4.1.1",
"@types/debounce-promise": "^3.1.8", "@types/debounce-promise": "^3.1.8",
"@types/isomorphic-fetch": "^0.0.36",
"@types/pixelmatch": "^5.2.6", "@types/pixelmatch": "^5.2.6",
"@types/pngjs": "^6.0.4", "@types/pngjs": "^6.0.4",
"@types/react-modal": "^3.16.3", "@types/react-modal": "^3.16.3",
@ -122,8 +121,7 @@
"@types/wait-on": "^5.3.4", "@types/wait-on": "^5.3.4",
"@types/wicg-file-system-access": "^2020.9.6", "@types/wicg-file-system-access": "^2020.9.6",
"@types/ws": "^8.5.5", "@types/ws": "^8.5.5",
"@vitejs/plugin-react": "^4.1.1", "@vitejs/plugin-react": "^4.2.1",
"@vitest/coverage-istanbul": "^0.34.6",
"@wdio/cli": "^8.24.3", "@wdio/cli": "^8.24.3",
"@wdio/globals": "^8.24.3", "@wdio/globals": "^8.24.3",
"@wdio/local-runner": "^8.24.3", "@wdio/local-runner": "^8.24.3",
@ -144,10 +142,10 @@
"prettier": "^2.8.0", "prettier": "^2.8.0",
"setimmediate": "^1.0.5", "setimmediate": "^1.0.5",
"tailwindcss": "^3.3.6", "tailwindcss": "^3.3.6",
"vite": "^4.5.2", "vite": "^5.1.3",
"vite-plugin-eslint": "^1.8.1", "vite-plugin-eslint": "^1.8.1",
"vite-plugin-package-version": "^1.1.0", "vite-plugin-package-version": "^1.1.0",
"vite-tsconfig-paths": "^4.2.1", "vite-tsconfig-paths": "^4.3.1",
"vitest-webgl-canvas-mock": "^1.1.0", "vitest-webgl-canvas-mock": "^1.1.0",
"wait-on": "^7.2.0", "wait-on": "^7.2.0",
"yarn": "^1.22.19" "yarn": "^1.22.19"

View File

@ -211,7 +211,7 @@ class KclManager {
console.error('error parsing code', e) console.error('error parsing code', e)
if (e instanceof KCLError) { if (e instanceof KCLError) {
this.kclErrors = [e] this.kclErrors = [e]
if (e.msg === 'file is empty') engineCommandManager.endSession() if (e.msg === 'file is empty') engineCommandManager?.endSession()
} }
return null return null
} }

View File

@ -3,6 +3,11 @@ import { WebSocket } from 'ws'
import { vi } from 'vitest' import { vi } from 'vitest'
import 'vitest-webgl-canvas-mock' import 'vitest-webgl-canvas-mock'
import fetch from 'node-fetch'
// @ts-ignore
globalThis.fetch = fetch
class MockRTCPeerConnection { class MockRTCPeerConnection {
createDataChannel() { createDataChannel() {
return return

View File

@ -35,7 +35,7 @@ const config = defineConfig({
viteTsconfigPaths(), viteTsconfigPaths(),
eslint(), eslint(),
version(), version(),
] ],
}) })
export default config export default config

778
yarn.lock

File diff suppressed because it is too large Load Diff