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": "", "description": "",
"main": "server.js", "main": "server.js",
"scripts": { "scripts": {
"test-watch": "vitest", "test": "run-s test:db:reset test:test",
"test": "vitest run unit", "coverage": "run-s test:db:reset test:coverage",
"test:unit": "vitest run unit", "test-watch": "dotenv -e .env.test -- vitest unit --coverage",
"test:integration": "run-s db:test:cleanup db:test:migrate test:integration:test", "test:test": "dotenv -e .env.test -- vitest run --no-threads",
"test:integration:test": "dotenv -e .env.test -- vitest run --coverage --no-threads", "test:coverage": "dotenv -e .env.test -- vitest run --no-threads --coverage",
"db:test:migrate": "dotenv -e .env.test -- npx prisma db push", "test:db:reset": "dotenv -e .env.test -- npx prisma migrate reset -f",
"db:test:cleanup": "rm -f ./prisma/test.sqlite",
"coverage": "vitest run --coverage",
"build": "npx tsc", "build": "npx tsc",
"dev": "npx nodemon ./server.ts | npx pino-colada" "dev": "npx nodemon ./server.ts | npx pino-colada"
}, },

View File

@ -1,19 +1,13 @@
import app from "./app"; import app from "./app";
import request from "supertest"; import request from "supertest";
import { describe, it, expect, beforeAll } from "vitest"; import { describe, it, expect } from "vitest";
import prisma from "./client"; import prisma from "./client";
import logger from "./logger";
const testNote = { const testNote = {
ciphertext: "sample_ciphertext", ciphertext: "sample_ciphertext",
hmac: "sample_hmac", hmac: "sample_hmac",
}; };
beforeAll(() => {
// logger.level = "error";
logger.silent();
});
describe("GET /api/note", () => { describe("GET /api/note", () => {
it("returns a note for valid ID", async () => { it("returns a note for valid ID", async () => {
// Insert a note // Insert a note