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": "prettier --write src/",
|
||||||
"format-check": "prettier --check src/",
|
"format-check": "prettier --check src/",
|
||||||
"lint": "eslint . --fix",
|
"lint": "eslint . --fix",
|
||||||
"pretest:unit": "tsx ../docs/api/generate.ts && npm run build",
|
"test:unit": "vitest --run",
|
||||||
"test:unit": "VITE_API_BASE_URL='http://localhost:9876/api' vitest --run",
|
|
||||||
"test:e2e": "playwright test"
|
"test:e2e": "playwright test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
export const apiConfig = {
|
export const apiConfig = {
|
||||||
baseUrl: ((): string => {
|
baseUrl: ((): string => {
|
||||||
|
if (import.meta.env.MODE === "test") {
|
||||||
|
// TODO Remove hardcoding
|
||||||
|
return "http://localhost:9876/api";
|
||||||
|
}
|
||||||
|
|
||||||
if (import.meta.env.VITE_API_BASE_URL) {
|
if (import.meta.env.VITE_API_BASE_URL) {
|
||||||
return 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> {
|
export async function setup(): Promise<void> {
|
||||||
// Precompile needed packages
|
// Precompile needed packages
|
||||||
spawnSync("npm", ["run", "predev"], {
|
spawnSync("npx", ["tsc", "--build", "tsconfig.json"], {
|
||||||
cwd: "../backend",
|
cwd: `../common`,
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spin up the backend
|
// Spin up the backend
|
||||||
backendProcess = spawn("tsx", ["--env-file=.env.test", "tool/startTestApp.ts"], {
|
backendProcess = spawn("npx", ["tsx", "--env-file=.env.test", "tool/startTestApp.ts"], {
|
||||||
cwd: "../backend",
|
cwd: `../backend`,
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
env: {
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue