mocha 1.10.0 → 1.11.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.
package/History.md CHANGED
@@ -1,4 +1,17 @@
1
1
 
2
+ 1.11.0 / 2013-06-12
3
+ ==================
4
+
5
+ * add --prof support
6
+ * add --harmony support
7
+ * add --harmony-generators support
8
+ * add "Uncaught " prefix to uncaught exceptions
9
+ * add web workers support
10
+ * add `suite.skip()`
11
+ * change to output # of pending / passing even on failures. Closes #872
12
+ * fix: prevent hooks from being called if we are bailing
13
+ * fix `this.timeout(0)`
14
+
2
15
  1.10.0 / 2013-05-21
3
16
  ==================
4
17
 
package/bin/mocha CHANGED
@@ -28,6 +28,8 @@ process.argv.slice(2).forEach(function(arg){
28
28
  case '--harmony':
29
29
  case '--harmony-proxies':
30
30
  case '--harmony-collections':
31
+ case '--harmony-generators':
32
+ case '--prof':
31
33
  args.unshift(arg);
32
34
  break;
33
35
  default:
package/component.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mocha",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "repo": "visionmedia/mocha",
5
5
  "description": "simple, flexible, fun test framework",
6
6
  "keywords": [
@@ -4,5 +4,10 @@ exports.isatty = function(){
4
4
  };
5
5
 
6
6
  exports.getWindowSize = function(){
7
- return [window.innerHeight, window.innerWidth];
8
- };
7
+ if ('innerHeight' in global) {
8
+ return [global.innerHeight, global.innerWidth];
9
+ } else {
10
+ // In a Web Worker, the DOM Window is not available.
11
+ return [640, 480];
12
+ }
13
+ };
@@ -82,6 +82,17 @@ module.exports = function(suite){
82
82
  return suite;
83
83
  };
84
84
 
85
+ /**
86
+ * Pending suite.
87
+ */
88
+ context.suite.skip = function(title, fn) {
89
+ var suite = Suite.create(suites[0], title);
90
+ suite.pending = true;
91
+ suites.unshift(suite);
92
+ fn.call(suite);
93
+ suites.shift();
94
+ };
95
+
85
96
  /**
86
97
  * Exclusive test-case.
87
98
  */
@@ -98,8 +109,10 @@ module.exports = function(suite){
98
109
  */
99
110
 
100
111
  context.test = function(title, fn){
112
+ var suite = suites[0];
113
+ if (suite.pending) var fn = null;
101
114
  var test = new Test(title, fn);
102
- suites[0].addTest(test);
115
+ suite.addTest(test);
103
116
  return test;
104
117
  };
105
118
 
@@ -161,6 +161,11 @@ exports.list = function(failures){
161
161
  , expected = err.expected
162
162
  , escape = true;
163
163
 
164
+ // uncaught
165
+ if (err.uncaught) {
166
+ msg = 'Uncaught ' + msg;
167
+ }
168
+
164
169
  // explicitly show diff
165
170
  if (err.showDiff) {
166
171
  escape = false;
@@ -279,48 +284,38 @@ function Base(runner) {
279
284
  */
280
285
 
281
286
  Base.prototype.epilogue = function(){
282
- var stats = this.stats
283
- , fmt
284
- , tests;
287
+ var stats = this.stats;
288
+ var tests;
289
+ var fmt;
285
290
 
286
291
  console.log();
287
292
 
288
- function pluralize(n) {
289
- return 1 == n ? 'test' : 'tests';
290
- }
291
-
292
- // failure
293
- if (stats.failures) {
294
- fmt = color('bright fail', ' ' + exports.symbols.err)
295
- + color('fail', ' %d of %d %s failed')
296
- + color('light', ':')
297
-
298
- console.error(fmt,
299
- stats.failures,
300
- this.runner.total,
301
- pluralize(this.runner.total));
302
-
303
- Base.list(this.failures);
304
- console.error();
305
- return;
306
- }
307
-
308
- // pass
293
+ // passes
309
294
  fmt = color('bright pass', ' ')
310
- + color('green', ' %d %s complete')
295
+ + color('green', ' %d passing')
311
296
  + color('light', ' (%s)');
312
297
 
313
298
  console.log(fmt,
314
- stats.tests || 0,
315
- pluralize(stats.tests),
299
+ stats.passes || 0,
316
300
  ms(stats.duration));
317
301
 
318
302
  // pending
319
303
  if (stats.pending) {
320
304
  fmt = color('pending', ' ')
321
- + color('pending', ' %d %s pending');
305
+ + color('pending', ' %d pending');
306
+
307
+ console.log(fmt, stats.pending);
308
+ }
309
+
310
+ // failures
311
+ if (stats.failures) {
312
+ fmt = color('fail', ' %d failing');
313
+
314
+ console.error(fmt,
315
+ stats.failures);
322
316
 
323
- console.log(fmt, stats.pending, pluralize(stats.pending));
317
+ Base.list(this.failures);
318
+ console.error();
324
319
  }
325
320
 
326
321
  console.log();
package/lib/runnable.js CHANGED
@@ -131,16 +131,14 @@ Runnable.prototype.inspect = function(){
131
131
  */
132
132
 
133
133
  Runnable.prototype.resetTimeout = function(){
134
- var self = this
135
- , ms = this.timeout();
134
+ var self = this;
135
+ var ms = this.timeout() || 1e9;
136
136
 
137
137
  this.clearTimeout();
138
- if (ms) {
139
- this.timer = setTimeout(function(){
140
- self.callback(new Error('timeout of ' + ms + 'ms exceeded'));
141
- self.timedOut = true;
142
- }, ms);
143
- }
138
+ this.timer = setTimeout(function(){
139
+ self.callback(new Error('timeout of ' + ms + 'ms exceeded'));
140
+ self.timedOut = true;
141
+ }, ms);
144
142
  };
145
143
 
146
144
  /**
package/lib/runner.js CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  /**
3
2
  * Module dependencies.
4
3
  */
@@ -44,6 +43,7 @@ module.exports = Runner;
44
43
  * - `hook end` (hook) hook complete
45
44
  * - `pass` (test) test passed
46
45
  * - `fail` (test, err) test failed
46
+ * - `pending` (test) test pending
47
47
  *
48
48
  * @api public
49
49
  */
@@ -232,6 +232,7 @@ Runner.prototype.hook = function(name, fn){
232
232
  function next(i) {
233
233
  var hook = hooks[i];
234
234
  if (!hook) return fn();
235
+ if (self.failures && suite.bail()) return fn();
235
236
  self.currentRunnable = hook;
236
237
 
237
238
  self.emit('hook', hook);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mocha",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "simple, flexible, fun test framework",
5
5
  "keywords": [
6
6
  "mocha",
@@ -31,7 +31,7 @@
31
31
  "jade": "0.26.3",
32
32
  "diff": "1.0.2",
33
33
  "debug": "*",
34
- "mkdirp": "0.3.3",
34
+ "mkdirp": "0.3.5",
35
35
  "ms": "0.3.0",
36
36
  "glob": "3.2.1"
37
37
  },
package/test.js CHANGED
@@ -1,9 +1,13 @@
1
1
 
2
2
  describe('something', function(){
3
- it('should work', function(done){
4
- this.timeout(0);
5
- setTimeout(function(){
6
- done();
7
- }, 5999);
3
+ it('should work', function(){
4
+
5
+ })
6
+
7
+ // it('be pending')
8
+ // it('be pending')
9
+
10
+ it('should fail', function(){
11
+ // tasdf
8
12
  })
9
13
  })