forked from RisingStack/multi-process-nodejs-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.js
More file actions
41 lines (35 loc) · 899 Bytes
/
setup.js
File metadata and controls
41 lines (35 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'use strict'
const sinon = require('sinon')
const chai = require('chai')
const sinonChai = require('sinon-chai')
const winston = require('winston')
process.env.PORT = 3000
process.env.REDIS_URI = 'redis://localhost'
before(() => {
chai.use(sinonChai)
// we want to have logger.test() without flooding the console with other levels' messages
winston.setLevels({
debug: 5,
info: 4,
warning: 3,
error: 2,
critical: 1,
test: 0
})
winston.addColors({
debug: 'green',
info: 'cyan',
warn: 'yellow',
error: 'red',
critical: 'red',
test: 'blue'
})
winston.remove(winston.transports.Console)
winston.add(winston.transports.Console, { level: process.env.LOGGER_LEVEL || 'test', colorize: true })
})
beforeEach(function beforeEach () {
this.sandbox = sinon.sandbox.create()
})
afterEach(function afterEach () {
this.sandbox.restore()
})