better package scripts

This commit is contained in:
Maxime Cannoodt 2022-07-10 14:03:23 +02:00
parent 0b9c5a049a
commit c14782310a
2 changed files with 7 additions and 15 deletions

View File

@ -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"
},

View File

@ -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