fix(frontend): Selectieve testen in IDE
This commit is contained in:
		
							parent
							
								
									6017d9c54f
								
							
						
					
					
						commit
						196875538d
					
				
					 3 changed files with 10 additions and 6 deletions
				
			
		|  | @ -12,8 +12,7 @@ | |||
|         "format": "prettier --write src/", | ||||
|         "format-check": "prettier --check src/", | ||||
|         "lint": "eslint . --fix", | ||||
|         "pretest:unit": "tsx ../docs/api/generate.ts && npm run build", | ||||
|         "test:unit": "VITE_API_BASE_URL='http://localhost:9876/api' vitest --run", | ||||
|         "test:unit": "vitest --run", | ||||
|         "test:e2e": "playwright test" | ||||
|     }, | ||||
|     "dependencies": { | ||||
|  |  | |||
|  | @ -1,5 +1,10 @@ | |||
| export const apiConfig = { | ||||
|     baseUrl: ((): string => { | ||||
|         if (import.meta.env.MODE === "test") { | ||||
|             // TODO Remove hardcoding
 | ||||
|             return "http://localhost:9876/api"; | ||||
|         } | ||||
| 
 | ||||
|         if (import.meta.env.VITE_API_BASE_URL) { | ||||
|             return import.meta.env.VITE_API_BASE_URL; | ||||
|         } | ||||
|  |  | |||
|  | @ -16,14 +16,14 @@ async function waitForEndpoint(url: string, delay = 1000, retries = 60): Promise | |||
| 
 | ||||
| export async function setup(): Promise<void> { | ||||
|     // Precompile needed packages
 | ||||
|     spawnSync("npm", ["run", "predev"], { | ||||
|         cwd: "../backend", | ||||
|     spawnSync("npx", ["tsc", "--build", "tsconfig.json"], { | ||||
|         cwd: `../common`, | ||||
|         stdio: "inherit", | ||||
|     }); | ||||
| 
 | ||||
|     // Spin up the backend
 | ||||
|     backendProcess = spawn("tsx", ["--env-file=.env.test", "tool/startTestApp.ts"], { | ||||
|         cwd: "../backend", | ||||
|     backendProcess = spawn("npx", ["tsx", "--env-file=.env.test", "tool/startTestApp.ts"], { | ||||
|         cwd: `../backend`, | ||||
|         stdio: "inherit", | ||||
|         env: { | ||||
|             ...process.env, | ||||
|  |  | |||
		Reference in a new issue