Skip to content

Commit cfd47dc

Browse files
committed
fix: update NODE_ENV options to include 'test' and adjust logger initialization logic
1 parent 5f54321 commit cfd47dc

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

template/apps/api/src/environment.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ declare global {
22
namespace NodeJS {
33
interface ProcessEnv {
44
APP_ENV: 'development' | 'staging' | 'production';
5-
NODE_ENV: 'development' | 'staging' | 'production';
5+
NODE_ENV: 'development' | 'test' | 'staging' | 'production';
66
PORT?: number;
77
PWD: string;
88
}

template/apps/api/src/logger.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import _ from 'lodash';
22
import process from 'node:process';
33
import winston from 'winston';
44

5-
import config from 'config';
6-
75
const formatToPrettyJson = winston.format.printf(({ level, message }) => {
86
if (_.isPlainObject(message)) {
97
message = JSON.stringify(message, null, 4);
@@ -48,7 +46,7 @@ const createConsoleLogger = (isDev = false) => {
4846
});
4947
};
5048

51-
const consoleLogger = createConsoleLogger(config?.IS_DEV ?? process.env.APP_ENV === 'development');
49+
const consoleLogger = createConsoleLogger(process.env.APP_ENV === 'development' || process.env.NODE_ENV === 'test');
5250

5351
globalThis.logger = consoleLogger;
5452

0 commit comments

Comments
 (0)