Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const express = require("express");
require("dotenv").config();
require("dotenv").config({ quiet: true });

const app = express();
app.use(express.json());
Expand Down
5 changes: 3 additions & 2 deletions src/config/prisma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ const { PrismaPg } = require("@prisma/adapter-pg");
const { Pool } = require("pg");

const path = process.env.NODE_ENV === "test" ? "tests/.env.test" : ".env";
require("dotenv").config({ path, override: false });
require("dotenv").config({ path, override: false, quiet: true });

const prismaLog = process.env.NODE_ENV === "test" ? [] : ["error", "warn"];
const globalForPrisma = globalThis;

if (!globalForPrisma.__authApiPool) {
Expand All @@ -16,7 +17,7 @@ if (!globalForPrisma.__authApiPool) {
if (!globalForPrisma.__authApiPrisma) {
globalForPrisma.__authApiPrisma = new PrismaClient({
adapter: new PrismaPg(globalForPrisma.__authApiPool),
log: ["error", "warn"],
log: prismaLog,
});
}

Expand Down
3 changes: 2 additions & 1 deletion src/logger.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const pino = require("pino");

const isTestEnv = process.env.NODE_ENV === "test";
// Logger base: JSON, nível info por padrão
const logger = pino({
level: process.env.LOG_LEVEL || "info",
level: process.env.LOG_LEVEL || (isTestEnv ? "silent" : "info"),
transport:
process.env.NODE_ENV === "development"
? {
Expand Down
1 change: 1 addition & 0 deletions tests/jest.env.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Carrega variáveis de teste a partir do arquivo correto (dentro de tests/)
require("dotenv").config({
path: "tests/.env.test",
quiet: true,
});