improve vitest hang (#1470)
* improve vitest hang * fmt * make types happy * fix types * fix
This commit is contained in:
		
							
								
								
									
										2
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							@ -86,8 +86,6 @@ jobs:
 | 
			
		||||
 | 
			
		||||
      - run: yarn test:nowatch
 | 
			
		||||
 | 
			
		||||
      - run: yarn test:cov
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  prepare-json-files:
 | 
			
		||||
    runs-on: ubuntu-latest  # seperate job on Ubuntu for easy string manipulations (compared to Windows)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										12
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								package.json
									
									
									
									
									
								
							@ -34,6 +34,7 @@
 | 
			
		||||
    "fuse.js": "^7.0.0",
 | 
			
		||||
    "http-server": "^14.1.1",
 | 
			
		||||
    "json-rpc-2.0": "^1.6.0",
 | 
			
		||||
    "node-fetch": "^3.3.2",
 | 
			
		||||
    "re-resizable": "^6.9.11",
 | 
			
		||||
    "react": "^18.2.0",
 | 
			
		||||
    "react-dom": "^18.2.0",
 | 
			
		||||
@ -51,7 +52,7 @@
 | 
			
		||||
    "ts-node": "^10.9.1",
 | 
			
		||||
    "typescript": "^5.2.2",
 | 
			
		||||
    "uuid": "^9.0.1",
 | 
			
		||||
    "vitest": "^0.34.6",
 | 
			
		||||
    "vitest": "^1.3.1",
 | 
			
		||||
    "vscode-jsonrpc": "^8.1.0",
 | 
			
		||||
    "vscode-languageserver-protocol": "^3.17.5",
 | 
			
		||||
    "wasm-pack": "^0.12.1",
 | 
			
		||||
@ -72,7 +73,6 @@
 | 
			
		||||
    "test": "vitest --mode development",
 | 
			
		||||
    "test:nowatch": "vitest run --mode development",
 | 
			
		||||
    "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",
 | 
			
		||||
    "simpleserver:ci": "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",
 | 
			
		||||
    "@types/crypto-js": "^4.1.1",
 | 
			
		||||
    "@types/debounce-promise": "^3.1.8",
 | 
			
		||||
    "@types/isomorphic-fetch": "^0.0.36",
 | 
			
		||||
    "@types/pixelmatch": "^5.2.6",
 | 
			
		||||
    "@types/pngjs": "^6.0.4",
 | 
			
		||||
    "@types/react-modal": "^3.16.3",
 | 
			
		||||
@ -122,8 +121,7 @@
 | 
			
		||||
    "@types/wait-on": "^5.3.4",
 | 
			
		||||
    "@types/wicg-file-system-access": "^2020.9.6",
 | 
			
		||||
    "@types/ws": "^8.5.5",
 | 
			
		||||
    "@vitejs/plugin-react": "^4.1.1",
 | 
			
		||||
    "@vitest/coverage-istanbul": "^0.34.6",
 | 
			
		||||
    "@vitejs/plugin-react": "^4.2.1",
 | 
			
		||||
    "@wdio/cli": "^8.24.3",
 | 
			
		||||
    "@wdio/globals": "^8.24.3",
 | 
			
		||||
    "@wdio/local-runner": "^8.24.3",
 | 
			
		||||
@ -144,10 +142,10 @@
 | 
			
		||||
    "prettier": "^2.8.0",
 | 
			
		||||
    "setimmediate": "^1.0.5",
 | 
			
		||||
    "tailwindcss": "^3.3.6",
 | 
			
		||||
    "vite": "^4.5.2",
 | 
			
		||||
    "vite": "^5.1.3",
 | 
			
		||||
    "vite-plugin-eslint": "^1.8.1",
 | 
			
		||||
    "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",
 | 
			
		||||
    "wait-on": "^7.2.0",
 | 
			
		||||
    "yarn": "^1.22.19"
 | 
			
		||||
 | 
			
		||||
@ -211,7 +211,7 @@ class KclManager {
 | 
			
		||||
      console.error('error parsing code', e)
 | 
			
		||||
      if (e instanceof KCLError) {
 | 
			
		||||
        this.kclErrors = [e]
 | 
			
		||||
        if (e.msg === 'file is empty') engineCommandManager.endSession()
 | 
			
		||||
        if (e.msg === 'file is empty') engineCommandManager?.endSession()
 | 
			
		||||
      }
 | 
			
		||||
      return null
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,11 @@ import { WebSocket } from 'ws'
 | 
			
		||||
import { vi } from 'vitest'
 | 
			
		||||
import 'vitest-webgl-canvas-mock'
 | 
			
		||||
 | 
			
		||||
import fetch from 'node-fetch'
 | 
			
		||||
 | 
			
		||||
// @ts-ignore
 | 
			
		||||
globalThis.fetch = fetch
 | 
			
		||||
 | 
			
		||||
class MockRTCPeerConnection {
 | 
			
		||||
  createDataChannel() {
 | 
			
		||||
    return
 | 
			
		||||
 | 
			
		||||
@ -35,7 +35,7 @@ const config = defineConfig({
 | 
			
		||||
    viteTsconfigPaths(),
 | 
			
		||||
    eslint(),
 | 
			
		||||
    version(),
 | 
			
		||||
  ]
 | 
			
		||||
  ],
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
export default config
 | 
			
		||||
		Reference in New Issue
	
	Block a user