Socialify

Folder ..

Viewing logger.js
33 lines (28 loc) • 1023.0 B

 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
'use strict';

require('should')();
const index = require('..');

describe('logger', () => {
  it('should log at debug level when --verbose is set', () => {
    index.options.verbose = true;
    const logger = index.logger();
    logger.level.should.equal('debug');
  });

  it('should log at debug level when NODE_COVERALLS_DEBUG is set in env', () => {
    index.options.verbose = false;
    process.env.NODE_COVERALLS_DEBUG = 1;
    const logger = index.logger();
    logger.level.should.equal('debug');
  });

  it('should log at debug level when NODE_COVERALLS_DEBUG is set in env as a string', () => {
    index.options.verbose = false;
    process.env.NODE_COVERALLS_DEBUG = '1';
    const logger = index.logger();
    logger.level.should.equal('debug');
  });

  it('should log at warn level when NODE_COVERALLS_DEBUG not set and no --verbose', () => {
    index.options.verbose = false;
    process.env.NODE_COVERALLS_DEBUG = 0;
    const logger = index.logger();
    logger.level.should.equal('error');
  });
});