forked from mochajs/mocha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrep.js
48 lines (41 loc) · 1.45 KB
/
grep.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
var Mocha = require('../');
describe('Mocha', function(){
describe('"grep" option', function(){
it('should add a RegExp to the mocha.options object', function(){
var mocha = new Mocha({ grep: /foo.*/ });
mocha.options.grep.toString().should.equal('/foo.*/');
})
it('should convert string to a RegExp', function(){
var mocha = new Mocha({ grep: 'foo.*' });
mocha.options.grep.toString().should.equal('/foo.*/');
})
})
describe('"fgrep" option', function(){
it('should escape and convert string to a RegExp', function(){
var mocha = new Mocha({ fgrep: 'foo.*' });
mocha.options.grep.toString().should.equal('/foo\\.\\*/');
})
})
describe('.grep()', function(){
it('should add a RegExp to the mocha.options object', function(){
var mocha = new Mocha;
mocha.grep(/foo/);
mocha.options.grep.toString().should.equal('/foo/');
})
it('should convert grep string to a RegExp', function(){
var mocha = new Mocha;
mocha.grep('foo');
mocha.options.grep.toString().should.equal('/foo/');
})
it('should return it\'s parent Mocha object for chainability', function(){
var mocha = new Mocha;
mocha.grep().should.equal(mocha);
})
})
describe('"invert" option', function(){
it('should add a Boolean to the mocha.options object', function(){
var mocha = new Mocha({ invert: true });
mocha.options.invert.should.be.ok();
})
})
})