-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
59 lines (48 loc) · 1.78 KB
/
test.js
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
require('mocha')
require('should')
var showHelp = require('./index')
describe('set-verbosity', function () {
describe('when -v is provided', function () {
it('it should set DEBUG=current_module', function () {
showHelp.raw('some', 'node some.js -v');
process.env['DEBUG'].should.eql('some')
})
})
describe('when -v moduleA,moduleB is provided', function () {
it('it should set DEBUG=moduleA,moduleB', function () {
showHelp.raw('some', 'node some.js -v moduleA,moduleB')
process.env['DEBUG'].should.eql('moduleA,moduleB')
})
})
describe('when -v -d is provided', function () {
it('it should not set DEBUG=-d', function () {
showHelp.raw('some', 'node some.js -v -d')
process.env['DEBUG'].should.not.eql('-d')
})
})
describe('when --verbose is provided', function () {
it('it should set DEBUG=current_module', function () {
showHelp.raw('some', 'node some.js --verbose')
process.env['DEBUG'].should.eql('some')
})
})
describe('when --verbose moduleA,moduleB is provided', function () {
it('it should set DEBUG=moduleA,moduleB', function () {
showHelp.raw('some', 'node some.js --verbose moduleA,moduleB')
process.env['DEBUG'].should.eql('moduleA,moduleB')
})
})
describe('when --verbose -d is provided', function () {
it('it should not set DEBUG=-d', function () {
showHelp.raw('some', 'node some.js --verbose -d')
process.env['DEBUG'].should.not.eql('-d')
})
})
describe('when -v|--verbose is not provided, it does not change env', function () {
it('it should not set DEBUG=moduleA,moduleB', function () {
process.env['DEBUG'] = 'already set!'
showHelp.raw('some', 'node some.js')
process.env['DEBUG'].should.eql('already set!')
})
})
})