how can prevent morgan to work in test enviroment

JavaScript
const logger = require('morgan');
const app = express();
app.use(logger('dev', { skip: (req, res) => process.env.NODE_ENV === 'test' }));
Source

Also in JavaScript: