mocha 1.21.4 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +226 -0
  2. package/bin/_mocha +26 -47
  3. package/bin/mocha +8 -1
  4. package/index.js +1 -2
  5. package/lib/browser/debug.js +0 -1
  6. package/lib/browser/diff.js +16 -1
  7. package/lib/browser/escape-string-regexp.js +11 -0
  8. package/lib/browser/events.js +1 -2
  9. package/lib/browser/glob.js +0 -0
  10. package/lib/browser/progress.js +6 -6
  11. package/lib/browser/tty.js +0 -1
  12. package/lib/context.js +0 -1
  13. package/lib/hook.js +0 -1
  14. package/lib/interfaces/bdd.js +4 -4
  15. package/lib/interfaces/exports.js +1 -2
  16. package/lib/interfaces/index.js +0 -1
  17. package/lib/interfaces/qunit.js +2 -2
  18. package/lib/interfaces/tdd.js +4 -4
  19. package/lib/mocha.js +32 -9
  20. package/lib/ms.js +1 -1
  21. package/lib/reporters/base.js +11 -13
  22. package/lib/reporters/doc.js +0 -1
  23. package/lib/reporters/dot.js +0 -1
  24. package/lib/reporters/html-cov.js +1 -2
  25. package/lib/reporters/html.js +13 -5
  26. package/lib/reporters/index.js +0 -1
  27. package/lib/reporters/json-cov.js +1 -2
  28. package/lib/reporters/json-stream.js +4 -3
  29. package/lib/reporters/json.js +7 -2
  30. package/lib/reporters/landing.js +3 -4
  31. package/lib/reporters/list.js +0 -1
  32. package/lib/reporters/markdown.js +15 -6
  33. package/lib/reporters/min.js +0 -1
  34. package/lib/reporters/nyan.js +14 -14
  35. package/lib/reporters/spec.js +0 -1
  36. package/lib/reporters/tap.js +0 -1
  37. package/lib/reporters/templates/coverage.jade +2 -1
  38. package/lib/reporters/templates/style.html +1 -1
  39. package/lib/reporters/xunit.js +41 -10
  40. package/lib/runnable.js +8 -6
  41. package/lib/runner.js +17 -9
  42. package/lib/suite.js +3 -3
  43. package/lib/test.js +0 -1
  44. package/lib/utils.js +247 -49
  45. package/mocha.js +487 -172
  46. package/package.json +20 -13
  47. package/Readme.md +0 -203
package/README.md ADDED
@@ -0,0 +1,226 @@
1
+ [![Build Status](https://secure.travis-ci.org/mochajs/mocha.png)](http://travis-ci.org/mochajs/mocha)
2
+
3
+ [![Mocha test framework](http://f.cl.ly/items/3l1k0n2A1U3M1I1L210p/Screen%20Shot%202012-02-24%20at%202.21.43%20PM.png)](http://mochajs.org)
4
+
5
+ Mocha is a simple, flexible, fun JavaScript test framework for node.js and the browser. For more information view the [documentation](http://mochajs.org).
6
+
7
+ ## Contributors
8
+
9
+ ```
10
+ project : mocha
11
+ repo age : 3 years, 4 months
12
+ active : 509 days
13
+ commits : 1575
14
+ files : 153
15
+ authors :
16
+ 977 TJ Holowaychuk 62.0%
17
+ 132 Travis Jeffery 8.4%
18
+ 63 Christopher Hiller 4.0%
19
+ 31 Guillermo Rauch 2.0%
20
+ 27 Joshua Appelman 1.7%
21
+ 13 Attila Domokos 0.8%
22
+ 10 John Firebaugh 0.6%
23
+ 8 Nathan Rajlich 0.5%
24
+ 8 Jo Liss 0.5%
25
+ 6 Mike Pennisi 0.4%
26
+ 6 Brendan Nee 0.4%
27
+ 6 James Carr 0.4%
28
+ 5 Aaron Heckmann 0.3%
29
+ 5 Raynos 0.3%
30
+ 5 Ryunosuke SATO 0.3%
31
+ 4 hokaccha 0.3%
32
+ 4 Jonathan Ong 0.3%
33
+ 4 Joshua Krall 0.3%
34
+ 4 Domenic Denicola 0.3%
35
+ 4 Forbes Lindesay 0.3%
36
+ 4 Xavier Antoviaque 0.3%
37
+ 4 David da Silva 0.3%
38
+ 3 Ariel Mashraki 0.2%
39
+ 3 Ben Bradley 0.2%
40
+ 3 Merrick Christensen 0.2%
41
+ 3 Andreas Lind Petersen 0.2%
42
+ 3 Nathan Bowser 0.2%
43
+ 3 Cory Thomas 0.2%
44
+ 3 Benjie Gillam 0.2%
45
+ 3 Wil Moore III 0.2%
46
+ 3 Ben Lindsey 0.2%
47
+ 3 Tyson Tate 0.2%
48
+ 3 Paul Miller 0.2%
49
+ 3 eiji.ienaga 0.2%
50
+ 3 Mathieu Desvé 0.2%
51
+ 3 Jesse Dailey 0.2%
52
+ 3 fool2fish 0.2%
53
+ 3 Fredrik Enestad 0.2%
54
+ 3 Sindre Sorhus 0.2%
55
+ 3 Valentin Agachi 0.2%
56
+ 2 jsdevel 0.1%
57
+ 2 Arian Stolwijk 0.1%
58
+ 2 Juzer Ali 0.1%
59
+ 2 David Henderson 0.1%
60
+ 2 Justin DuJardin 0.1%
61
+ 2 Paul Armstrong 0.1%
62
+ 2 Pete Hawkins 0.1%
63
+ 2 Jonas Westerlund 0.1%
64
+ 2 Quang Van 0.1%
65
+ 2 Simon Gaeremynck 0.1%
66
+ 2 travis jeffery 0.1%
67
+ 2 Dominique Quatravaux 0.1%
68
+ 2 Jacob Wejendorp 0.1%
69
+ 2 Shawn Krisman 0.1%
70
+ 2 FARKAS Máté 0.1%
71
+ 2 Konstantin Käfer 0.1%
72
+ 2 Timo Tijhof 0.1%
73
+ 2 Sean Lang 0.1%
74
+ 2 Quanlong He 0.1%
75
+ 2 Glen Mailer 0.1%
76
+ 2 Alexander Early 0.1%
77
+ 2 Ian Storm Taylor 0.1%
78
+ 2 Brian Beck 0.1%
79
+ 2 Michael Riley 0.1%
80
+ 2 Michael Schoonmaker 0.1%
81
+ 2 domenic 0.1%
82
+ 2 fcrisci 0.1%
83
+ 2 Buck Doyle 0.1%
84
+ 2 Nathan Alderson 0.1%
85
+ 1 Mal Graty 0.1%
86
+ 1 Marc Kuo 0.1%
87
+ 1 Matija Marohnić 0.1%
88
+ 1 Matt Robenolt 0.1%
89
+ 1 Matt Smith 0.1%
90
+ 1 Matthew Shanley 0.1%
91
+ 1 Mattias Tidlund 0.1%
92
+ 1 Michael Jackson 0.1%
93
+ 1 Michael Olson 0.1%
94
+ 1 Michal Charemza 0.1%
95
+ 1 Nathan Black 0.1%
96
+ 1 Nick Fitzgerald 0.1%
97
+ 1 Noshir Patel 0.1%
98
+ 1 Panu Horsmalahti 0.1%
99
+ 1 Phil Sung 0.1%
100
+ 1 R56 0.1%
101
+ 1 Refael Ackermann 0.1%
102
+ 1 Richard Dingwall 0.1%
103
+ 1 Richard Knop 0.1%
104
+ 1 Rob Wu 0.1%
105
+ 1 Romain Prieto 0.1%
106
+ 1 Roman Neuhauser 0.1%
107
+ 1 Roman Shtylman 0.1%
108
+ 1 Russ Bradberry 0.1%
109
+ 1 Russell Munson 0.1%
110
+ 1 Rustem Mustafin 0.1%
111
+ 1 Salehen Shovon Rahman 0.1%
112
+ 1 Sasha Koss 0.1%
113
+ 1 Seiya Konno 0.1%
114
+ 1 Shaine Hatch 0.1%
115
+ 1 Simon Goumaz 0.1%
116
+ 1 Standa Opichal 0.1%
117
+ 1 Stephen Mathieson 0.1%
118
+ 1 Steve Mason 0.1%
119
+ 1 Tapiwa Kelvin 0.1%
120
+ 1 Teddy Zeenny 0.1%
121
+ 1 Tim Ehat 0.1%
122
+ 1 Vadim Nikitin 0.1%
123
+ 1 Victor Costan 0.1%
124
+ 1 Will Langstroth 0.1%
125
+ 1 Yanis Wang 0.1%
126
+ 1 Yuest Wang 0.1%
127
+ 1 Zsolt Takács 0.1%
128
+ 1 abrkn 0.1%
129
+ 1 airportyh 0.1%
130
+ 1 badunk 0.1%
131
+ 1 claudyus 0.1%
132
+ 1 dasilvacontin 0.1%
133
+ 1 fengmk2 0.1%
134
+ 1 gaye 0.1%
135
+ 1 grasGendarme 0.1%
136
+ 1 lakmeer 0.1%
137
+ 1 lodr 0.1%
138
+ 1 mrShturman 0.1%
139
+ 1 nishigori 0.1%
140
+ 1 omardelarosa 0.1%
141
+ 1 qiuzuhui 0.1%
142
+ 1 samuel goldszmidt 0.1%
143
+ 1 sebv 0.1%
144
+ 1 startswithaj 0.1%
145
+ 1 tgautier@yahoo.com 0.1%
146
+ 1 traleig1 0.1%
147
+ 1 vlad 0.1%
148
+ 1 yuitest 0.1%
149
+ 1 zhiyelee 0.1%
150
+ 1 Adam Crabtree 0.1%
151
+ 1 Andreas Brekken 0.1%
152
+ 1 Andrew Nesbitt 0.1%
153
+ 1 Andrey Popp 0.1%
154
+ 1 Arnaud Brousseau 0.1%
155
+ 1 Atsuya Takagi 0.1%
156
+ 1 Austin Birch 0.1%
157
+ 1 Ben Noordhuis 0.1%
158
+ 1 Bjørge Næss 0.1%
159
+ 1 Brian Lalor 0.1%
160
+ 1 Brian M. Carlson 0.1%
161
+ 1 Brian Moore 0.1%
162
+ 1 Bryan Donovan 0.1%
163
+ 1 C. Scott Ananian 0.1%
164
+ 1 Casey Foster 0.1%
165
+ 1 ChrisWren 0.1%
166
+ 1 Connor Dunn 0.1%
167
+ 1 Corey Butler 0.1%
168
+ 1 Daniel Stockman 0.1%
169
+ 1 Dave McKenna 0.1%
170
+ 1 Denis Bardadym 0.1%
171
+ 1 Devin Weaver 0.1%
172
+ 1 Di Wu 0.1%
173
+ 1 Diogo Monteiro 0.1%
174
+ 1 Dmitry Shirokov 0.1%
175
+ 1 Dr. Travis Jeffery 0.1%
176
+ 1 Fedor Indutny 0.1%
177
+ 1 Florian Margaine 0.1%
178
+ 1 Frederico Silva 0.1%
179
+ 1 Fredrik Lindin 0.1%
180
+ 1 Gareth Aye 0.1%
181
+ 1 Gareth Murphy 0.1%
182
+ 1 Gavin Mogan 0.1%
183
+ 1 Giovanni Bassi 0.1%
184
+ 1 Glen Huang 0.1%
185
+ 1 Greg Perkins 0.1%
186
+ 1 Harish 0.1%
187
+ 1 Harry Brundage 0.1%
188
+ 1 Herman Junge 0.1%
189
+ 1 Ian Young 0.1%
190
+ 1 Ivan 0.1%
191
+ 1 JP Bochi 0.1%
192
+ 1 Jaakko Salonen 0.1%
193
+ 1 Jakub Nešetřil 0.1%
194
+ 1 James Bowes 0.1%
195
+ 1 James Lal 0.1%
196
+ 1 Jan Kopriva 0.1%
197
+ 1 Jason Barry 0.1%
198
+ 1 Javier Aranda 0.1%
199
+ 1 Jean Ponchon 0.1%
200
+ 1 Jeff Kunkle 0.1%
201
+ 1 Jeremy Martin 0.1%
202
+ 1 Jimmy Cuadra 0.1%
203
+ 1 John Doty 0.1%
204
+ 1 Jonathan Creamer 0.1%
205
+ 1 Jonathan Park 0.1%
206
+ 1 Jussi Virtanen 0.1%
207
+ 1 Katie Gengler 0.1%
208
+ 1 Kazuhito Hokamura 0.1%
209
+ 1 Kent C. Dodds 0.1%
210
+ 1 Kevin Conway 0.1%
211
+ 1 Kirill Korolyov 0.1%
212
+ 1 Koen Punt 0.1%
213
+ 1 Laszlo Bacsi 0.1%
214
+ 1 Liam Newman 0.1%
215
+ 1 Linus Unnebäck 0.1%
216
+ 1 László Bácsi 0.1%
217
+ 1 Maciej Małecki 0.1%
218
+ ```
219
+
220
+ ## Links
221
+
222
+ - [Google Group](http://groups.google.com/group/mochajs)
223
+ - [Wiki](https://github.com/mochajs/mocha/wiki)
224
+ - Mocha [Extensions and reporters](https://github.com/mochajs/mocha/wiki)
225
+
226
+ Mocha also has a chat room on [Slack](https://slack.com). If you'd like to join, [shoot us an email](mailto:tj@travisjeffery.com?subject=mocha%20slack%20room%20invite) from the address you want us to invite you under and we'll happily send you an invite!
package/bin/_mocha CHANGED
@@ -5,17 +5,13 @@
5
5
  */
6
6
 
7
7
  var program = require('commander')
8
- , sprintf = require('util').format
9
8
  , path = require('path')
10
9
  , fs = require('fs')
11
- , glob = require('glob')
12
10
  , resolve = path.resolve
13
11
  , exists = fs.existsSync || path.existsSync
14
12
  , Mocha = require('../')
15
13
  , utils = Mocha.utils
16
- , interfaces = Mocha.interfaces
17
14
  , join = path.join
18
- , basename = path.basename
19
15
  , cwd = process.cwd()
20
16
  , mocha = new Mocha;
21
17
 
@@ -65,6 +61,7 @@ program
65
61
  .option('-c, --colors', 'force enabling of colors')
66
62
  .option('-C, --no-colors', 'force disabling of colors')
67
63
  .option('-G, --growl', 'enable growl notification support')
64
+ .option('-O, --reporter-options <k=v,k2=v2,...>', 'reporter-specific options')
68
65
  .option('-R, --reporter <name>', 'specify the reporter to use', 'spec')
69
66
  .option('-S, --sort', "sort test files")
70
67
  .option('-b, --bail', "bail after first test failure")
@@ -179,7 +176,10 @@ var optsPath = process.argv.indexOf('--opts') !== -1
179
176
  try {
180
177
  var opts = fs.readFileSync(optsPath, 'utf8')
181
178
  .trim()
182
- .split(/\s+/);
179
+ .split(/\s+/)
180
+ .filter(function(value) {
181
+ return value ? true : false;
182
+ });
183
183
 
184
184
  process.argv = process.argv
185
185
  .slice(0, 2)
@@ -196,9 +196,22 @@ program.parse(process.argv);
196
196
 
197
197
  Error.stackTraceLimit = Infinity; // TODO: config
198
198
 
199
+ // reporter options
200
+
201
+ var reporterOptions = {};
202
+ if (program.reporterOptions !== undefined) {
203
+ program.reporterOptions.split(",").forEach(function(opt) {
204
+ var L = opt.split("=");
205
+ if (L.length != 2) {
206
+ throw new Error("invalid reporter option '" + opt + "'");
207
+ }
208
+ reporterOptions[L[0]] = L[1];
209
+ });
210
+ }
211
+
199
212
  // reporter
200
213
 
201
- mocha.reporter(program.reporter);
214
+ mocha.reporter(program.reporter, reporterOptions);
202
215
 
203
216
  // interface
204
217
 
@@ -282,27 +295,25 @@ program.compilers.forEach(function(c) {
282
295
  if (mod[0] == '.') mod = join(process.cwd(), mod);
283
296
  require(mod);
284
297
  extensions.push(ext);
298
+ program.watchExtensions.push(ext);
285
299
  });
286
300
 
287
- var re = new RegExp('\\.(' + extensions.join('|') + ')$');
288
-
289
301
  // requires
290
302
 
291
303
  requires.forEach(function(mod) {
292
304
  require(mod);
293
305
  });
294
306
 
295
- // files
307
+ //args
296
308
 
297
- var files = []
298
- , args = program.args;
309
+ var args = program.args;
299
310
 
300
311
  // default files to test/*.{js,coffee}
301
312
 
302
313
  if (!args.length) args.push('test');
303
314
 
304
315
  args.forEach(function(arg){
305
- files = files.concat(lookupFiles(arg, program.recursive));
316
+ files = files.concat(utils.lookupFiles(arg, extensions, program.recursive));
306
317
  });
307
318
 
308
319
  // resolve
@@ -328,7 +339,7 @@ if (program.watch) {
328
339
  });
329
340
 
330
341
 
331
- var watchFiles = utils.files(cwd, [ 'js', 'coffee', 'litcoffee', 'coffee.md' ].concat(program.watchExtensions));
342
+ var watchFiles = utils.files(cwd, [ 'js' ].concat(program.watchExtensions));
332
343
  var runAgain = false;
333
344
 
334
345
  function loadAndRun() {
@@ -357,6 +368,8 @@ if (program.watch) {
357
368
  function rerun() {
358
369
  purge();
359
370
  stop()
371
+ if (!program.grep)
372
+ mocha.grep(null);
360
373
  mocha.suite = mocha.suite.clone();
361
374
  mocha.suite.ctx = new Mocha.Context;
362
375
  mocha.ui(program.ui);
@@ -439,40 +452,6 @@ function stop() {
439
452
  clearInterval(play.timer);
440
453
  }
441
454
 
442
- /**
443
- * Lookup file names at the given `path`.
444
- */
445
-
446
- function lookupFiles(path, recursive) {
447
- var files = [];
448
-
449
- if (!exists(path)) {
450
- if (exists(path + '.js')) {
451
- path += '.js'
452
- } else {
453
- files = glob.sync(path);
454
- if (!files.length) throw new Error("cannot resolve path (or pattern) '" + path + "'");
455
- return files;
456
- }
457
- }
458
-
459
- var stat = fs.statSync(path);
460
- if (stat.isFile()) return path;
461
-
462
- fs.readdirSync(path).forEach(function(file){
463
- file = join(path, file);
464
- var stat = fs.statSync(file);
465
- if (stat.isDirectory()) {
466
- if (recursive) files = files.concat(lookupFiles(file, recursive));
467
- return
468
- }
469
- if (!stat.isFile() || !re.test(file) || basename(file)[0] == '.') return;
470
- files.push(file);
471
- });
472
-
473
- return files;
474
- }
475
-
476
455
  /**
477
456
  * Play the given array of strings.
478
457
  */
package/bin/mocha CHANGED
@@ -44,7 +44,7 @@ process.argv.slice(2).forEach(function(arg){
44
44
  }
45
45
  });
46
46
 
47
- var proc = spawn(process.argv[0], args, { customFds: [0,1,2] });
47
+ var proc = spawn(process.argv[0], args, { stdio: 'inherit' });
48
48
  proc.on('exit', function (code, signal) {
49
49
  process.on('exit', function(){
50
50
  if (signal) {
@@ -54,3 +54,10 @@ proc.on('exit', function (code, signal) {
54
54
  }
55
55
  });
56
56
  });
57
+
58
+ // terminate children.
59
+ process.on('SIGINT', function () {
60
+ proc.kill('SIGINT'); // calls runner.abort()
61
+ proc.kill('SIGTERM'); // if that didn't work, we're probably in an infinite loop, so make it die.
62
+ process.kill(process.pid, 'SIGINT');
63
+ });
package/index.js CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  module.exports = process.env.COV
3
2
  ? require('./lib-cov/mocha')
4
- : require('./lib/mocha');
3
+ : require('./lib/mocha');
@@ -1,4 +1,3 @@
1
-
2
1
  module.exports = function(type){
3
2
  return function(){
4
3
  }
@@ -165,7 +165,22 @@ var JsDiff = (function() {
165
165
 
166
166
  var LineDiff = new Diff();
167
167
  LineDiff.tokenize = function(value) {
168
- return value.split(/^/m);
168
+ var retLines = [],
169
+ lines = value.split(/^/m);
170
+
171
+ for(var i = 0; i < lines.length; i++) {
172
+ var line = lines[i],
173
+ lastLine = lines[i - 1];
174
+
175
+ // Merge lines that may contain windows new lines
176
+ if (line == '\n' && lastLine && lastLine[lastLine.length - 1] === '\r') {
177
+ retLines[retLines.length - 1] += '\n';
178
+ } else if (line) {
179
+ retLines.push(line);
180
+ }
181
+ }
182
+
183
+ return retLines;
169
184
  };
170
185
 
171
186
  return {
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
4
+
5
+ module.exports = function (str) {
6
+ if (typeof str !== 'string') {
7
+ throw new TypeError('Expected a string');
8
+ }
9
+
10
+ return str.replace(matchOperatorsRe, '\\$&');
11
+ };
@@ -1,4 +1,3 @@
1
-
2
1
  /**
3
2
  * Module exports.
4
3
  */
@@ -175,4 +174,4 @@ EventEmitter.prototype.emit = function (name) {
175
174
  }
176
175
 
177
176
  return true;
178
- };
177
+ };
File without changes
@@ -94,28 +94,28 @@ Progress.prototype.draw = function(ctx){
94
94
  , y = half
95
95
  , rad = half - 1
96
96
  , fontSize = this._fontSize;
97
-
97
+
98
98
  ctx.font = fontSize + 'px ' + this._font;
99
-
99
+
100
100
  var angle = Math.PI * 2 * (percent / 100);
101
101
  ctx.clearRect(0, 0, size, size);
102
-
102
+
103
103
  // outer circle
104
104
  ctx.strokeStyle = '#9f9f9f';
105
105
  ctx.beginPath();
106
106
  ctx.arc(x, y, rad, 0, angle, false);
107
107
  ctx.stroke();
108
-
108
+
109
109
  // inner circle
110
110
  ctx.strokeStyle = '#eee';
111
111
  ctx.beginPath();
112
112
  ctx.arc(x, y, rad - 1, 0, angle, true);
113
113
  ctx.stroke();
114
-
114
+
115
115
  // text
116
116
  var text = this._text || (percent | 0) + '%'
117
117
  , w = ctx.measureText(text).width;
118
-
118
+
119
119
  ctx.fillText(
120
120
  text
121
121
  , x - w / 2 + 1
@@ -1,4 +1,3 @@
1
-
2
1
  exports.isatty = function(){
3
2
  return true;
4
3
  };
package/lib/context.js CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  /**
3
2
  * Expose `Context`.
4
3
  */
package/lib/hook.js CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  /**
3
2
  * Module dependencies.
4
3
  */
@@ -1,11 +1,11 @@
1
-
2
1
  /**
3
2
  * Module dependencies.
4
3
  */
5
4
 
6
5
  var Suite = require('../suite')
7
6
  , Test = require('../test')
8
- , utils = require('../utils');
7
+ , utils = require('../utils')
8
+ , escapeRe = require('escape-string-regexp');
9
9
 
10
10
  /**
11
11
  * BDD-style interface:
@@ -108,7 +108,7 @@ module.exports = function(suite){
108
108
 
109
109
  context.it = context.specify = function(title, fn){
110
110
  var suite = suites[0];
111
- if (suite.pending) var fn = null;
111
+ if (suite.pending) fn = null;
112
112
  var test = new Test(title, fn);
113
113
  test.file = file;
114
114
  suite.addTest(test);
@@ -121,7 +121,7 @@ module.exports = function(suite){
121
121
 
122
122
  context.it.only = function(title, fn){
123
123
  var test = context.it(title, fn);
124
- var reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$';
124
+ var reString = '^' + escapeRe(test.fullTitle()) + '$';
125
125
  mocha.grep(new RegExp(reString));
126
126
  return test;
127
127
  };
@@ -1,4 +1,3 @@
1
-
2
1
  /**
3
2
  * Module dependencies.
4
3
  */
@@ -52,7 +51,7 @@ module.exports = function(suite){
52
51
  suites[0].addTest(test);
53
52
  }
54
53
  } else {
55
- var suite = Suite.create(suites[0], key);
54
+ suite = Suite.create(suites[0], key);
56
55
  suites.unshift(suite);
57
56
  visit(obj[key]);
58
57
  suites.shift();
@@ -1,4 +1,3 @@
1
-
2
1
  exports.bdd = require('./bdd');
3
2
  exports.tdd = require('./tdd');
4
3
  exports.qunit = require('./qunit');
@@ -1,10 +1,10 @@
1
-
2
1
  /**
3
2
  * Module dependencies.
4
3
  */
5
4
 
6
5
  var Suite = require('../suite')
7
6
  , Test = require('../test')
7
+ , escapeRe = require('escape-string-regexp')
8
8
  , utils = require('../utils');
9
9
 
10
10
  /**
@@ -109,7 +109,7 @@ module.exports = function(suite){
109
109
 
110
110
  context.test.only = function(title, fn){
111
111
  var test = context.test(title, fn);
112
- var reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$';
112
+ var reString = '^' + escapeRe(test.fullTitle()) + '$';
113
113
  mocha.grep(new RegExp(reString));
114
114
  };
115
115
 
@@ -1,11 +1,11 @@
1
-
2
1
  /**
3
2
  * Module dependencies.
4
3
  */
5
4
 
6
5
  var Suite = require('../suite')
7
6
  , Test = require('../test')
8
- , utils = require('../utils');;
7
+ , escapeRe = require('escape-string-regexp')
8
+ , utils = require('../utils');
9
9
 
10
10
  /**
11
11
  * TDD-style interface:
@@ -112,7 +112,7 @@ module.exports = function(suite){
112
112
 
113
113
  context.test = function(title, fn){
114
114
  var suite = suites[0];
115
- if (suite.pending) var fn = null;
115
+ if (suite.pending) fn = null;
116
116
  var test = new Test(title, fn);
117
117
  test.file = file;
118
118
  suite.addTest(test);
@@ -125,7 +125,7 @@ module.exports = function(suite){
125
125
 
126
126
  context.test.only = function(title, fn){
127
127
  var test = context.test(title, fn);
128
- var reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$';
128
+ var reString = '^' + escapeRe(test.fullTitle()) + '$';
129
129
  mocha.grep(new RegExp(reString));
130
130
  };
131
131