Skip to content

Commit 892f290

Browse files
committed
refactor: update test command to use --runInBand and clean up afterAll hook
1 parent f84bddd commit 892f290

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
5353
npx prisma generate
5454
npx prisma migrate deploy
55-
npm test -- --forceExit
55+
npm test -- --runInBand
5656
5757
- name: Create short SHA for tagging
5858
uses: benjlevesque/short-sha@v3.0

tests/user.test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const request = require("supertest");
22
const app = require("../server");
3-
const { PrismaClient } = require("../generated/prisma/index");
43
const prisma = require("../src/libs/prisma");
54

65
const RESTART_IDENTITY = `TRUNCATE TABLE "User" RESTART IDENTITY CASCADE;`;
@@ -74,7 +73,6 @@ describe('User API Endpoints', () => {
7473
});
7574

7675
afterAll(async () => {
77-
await prisma.user.deleteMany();
78-
await prisma.$executeRawUnsafe(RESTART_IDENTITY);
7976
await prisma.$disconnect();
77+
if (app) app.close();
8078
});

0 commit comments

Comments
 (0)