diff --git a/server/package.json b/server/package.json index acd7f03..f0ded55 100644 --- a/server/package.json +++ b/server/package.json @@ -4,14 +4,12 @@ "description": "", "main": "server.js", "scripts": { - "test-watch": "vitest", - "test": "vitest run unit", - "test:unit": "vitest run unit", - "test:integration": "run-s db:test:cleanup db:test:migrate test:integration:test", - "test:integration:test": "dotenv -e .env.test -- vitest run --coverage --no-threads", - "db:test:migrate": "dotenv -e .env.test -- npx prisma db push", - "db:test:cleanup": "rm -f ./prisma/test.sqlite", - "coverage": "vitest run --coverage", + "test": "run-s test:db:reset test:test", + "coverage": "run-s test:db:reset test:coverage", + "test-watch": "dotenv -e .env.test -- vitest unit --coverage", + "test:test": "dotenv -e .env.test -- vitest run --no-threads", + "test:coverage": "dotenv -e .env.test -- vitest run --no-threads --coverage", + "test:db:reset": "dotenv -e .env.test -- npx prisma migrate reset -f", "build": "npx tsc", "dev": "npx nodemon ./server.ts | npx pino-colada" }, diff --git a/server/src/app.integration.test.ts b/server/src/app.integration.test.ts index c7d462c..3ea2c1e 100644 --- a/server/src/app.integration.test.ts +++ b/server/src/app.integration.test.ts @@ -1,19 +1,13 @@ import app from "./app"; import request from "supertest"; -import { describe, it, expect, beforeAll } from "vitest"; +import { describe, it, expect } from "vitest"; import prisma from "./client"; -import logger from "./logger"; const testNote = { ciphertext: "sample_ciphertext", hmac: "sample_hmac", }; -beforeAll(() => { - // logger.level = "error"; - logger.silent(); -}); - describe("GET /api/note", () => { it("returns a note for valid ID", async () => { // Insert a note