Skip to content

Commit

Permalink
Don't fail tests if test api already running
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkedev committed Feb 15, 2024
1 parent 053b212 commit 4e3b7cf
Show file tree
Hide file tree
Showing 3 changed files with 706 additions and 676 deletions.
16 changes: 11 additions & 5 deletions test/api/setup.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import path from "path";
import dotenv from "dotenv";
import detect from "detect-port";
import type { Callback } from "lib";
import server from "../mpr/server";

dotenv.config({ path: path.resolve("api", ".env") });

export default async function(): Promise<Callback<void>> {
const mpr = await server(3001);
try {
await detect(3001);
const mpr = await server(3001);

return async function() {
mpr.closeAllConnections();
await new Promise(resolve => mpr.close(resolve));
};
return async function() {
mpr.closeAllConnections();
await new Promise(resolve => mpr.close(resolve));
};
} catch {
return async function() {};
}
}
6 changes: 3 additions & 3 deletions test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
"private": true,
"type": "module",
"scripts": {
"cypress": "cypress open --detached",
"e2e": "cypress run --e2e",
"smoke": "cypress run --config-file smoke/cypress.config.ts",
"smoke": "playwright test smoke",
"unit": "vitest run --coverage",
"watch": "vitest --coverage"
},
"devDependencies": {
"@testing-library/dom": "^9.3.4",
"@testing-library/svelte": "^4.1.0",
"@testing-library/user-event": "^14.5.2",
"@types/detect-port": "^1",
"@types/node": "^20.11.17",
"@types/resolve": "^1.20.6",
"@vitest/coverage-v8": "^1.2.2",
"detect-port": "^1.5.1",
"esbuild": "^0.20.0",
"jsdom": "^24.0.0",
"msw": "^2.2.0",
Expand Down
Loading

0 comments on commit 4e3b7cf

Please sign in to comment.