mocha 1.8.1 → 1.8.2

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,10 @@
1
1
 
2
+ 1.8.2 / 2013-03-11
3
+ ==================
4
+
5
+ * add `setImmediate` support for 0.10.x
6
+ * fix mocha -w spinner on windows
7
+
2
8
  1.8.1 / 2013-01-09
3
9
  ==================
4
10
 
package/bin/_mocha CHANGED
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  var program = require('commander')
8
+ , sprintf = require('util').format
8
9
  , path = require('path')
9
10
  , fs = require('fs')
10
11
  , resolve = path.resolve
@@ -284,14 +285,13 @@ if (program.watch) {
284
285
  process.exit();
285
286
  });
286
287
 
287
- var frames = [
288
- ' \u001b[96m◜ \u001b[90mwatching\u001b[0m'
289
- , ' \u001b[96m \u001b[90mwatching\u001b[0m'
290
- , ' \u001b[96m◝ \u001b[90mwatching\u001b[0m'
291
- , ' \u001b[96m◞ \u001b[90mwatching\u001b[0m'
292
- , ' \u001b[96m \u001b[90mwatching\u001b[0m'
293
- , ' \u001b[96m◟ \u001b[90mwatching\u001b[0m'
294
- ];
288
+ var spinner = 'win32' == process.platform
289
+ ? ['|','/','-','\\']
290
+ : ['◜','◠','◝','◞','◡','◟'];
291
+
292
+ var frames = spinner.map(function(c) {
293
+ return sprintf(' \u001b[96m%s \u001b[90mwatching\u001b[0m', c);
294
+ });
295
295
 
296
296
  var watchFiles = utils.files(cwd);
297
297
 
@@ -415,6 +415,6 @@ function play(arr, interval) {
415
415
 
416
416
  play.timer = setInterval(function(){
417
417
  var str = arr[i++ % len];
418
- process.stdout.write('\r' + str);
418
+ process.stdout.write('\u001b[0G' + str);
419
419
  }, interval);
420
420
  }
package/component.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mocha",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "repo": "visionmedia/mocha",
5
5
  "description": "simple, flexible, fun test framework",
6
6
  "keywords": [
package/lib/runner.js CHANGED
@@ -9,7 +9,8 @@ var EventEmitter = require('events').EventEmitter
9
9
  , utils = require('./utils')
10
10
  , filter = utils.filter
11
11
  , keys = utils.keys
12
- , noop = function(){};
12
+ , noop = function(){}
13
+ , immediately = global.setImmediate || process.nextTick;
13
14
 
14
15
  /**
15
16
  * Non-enumerable globals.
@@ -185,7 +186,7 @@ Runner.prototype.fail = function(test, err){
185
186
  if ('string' == typeof err) {
186
187
  err = new Error('the string "' + err + '" was thrown, throw an Error :)');
187
188
  }
188
-
189
+
189
190
  this.emit('fail', test, err);
190
191
  };
191
192
 
@@ -242,7 +243,7 @@ Runner.prototype.hook = function(name, fn){
242
243
  });
243
244
  }
244
245
 
245
- process.nextTick(function(){
246
+ immediately(function(){
246
247
  next(0);
247
248
  });
248
249
  };
@@ -485,14 +486,16 @@ Runner.prototype.run = function(fn){
485
486
  var self = this
486
487
  , fn = fn || function(){};
487
488
 
489
+ function uncaught(err){
490
+ self.uncaught(err);
491
+ }
492
+
488
493
  debug('start');
489
494
 
490
495
  // callback
491
496
  this.on('end', function(){
492
497
  debug('end');
493
- process.removeListener('uncaughtException', function(err){
494
- self.uncaught(err);
495
- });
498
+ process.removeListener('uncaughtException', uncaught);
496
499
  fn(self.failures);
497
500
  });
498
501
 
@@ -504,9 +507,7 @@ Runner.prototype.run = function(fn){
504
507
  });
505
508
 
506
509
  // uncaught exception
507
- process.on('uncaughtException', function(err){
508
- self.uncaught(err);
509
- });
510
+ process.on('uncaughtException', uncaught);
510
511
 
511
512
  return this;
512
513
  };
package/lib/template.html CHANGED
@@ -3,6 +3,7 @@
3
3
  <head>
4
4
  <title>Mocha</title>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
7
  <link rel="stylesheet" href="mocha.css" />
7
8
  </head>
8
9
  <body>
package/mocha.css CHANGED
@@ -229,3 +229,13 @@ code .init { color: #2F6FAD }
229
229
  code .string { color: #5890AD }
230
230
  code .keyword { color: #8A6343 }
231
231
  code .number { color: #2F6FAD }
232
+
233
+ @media screen and (max-device-width: 480px) {
234
+ body {
235
+ padding: 60px 0px;
236
+ }
237
+
238
+ #stats {
239
+ position: absolute;
240
+ }
241
+ }
package/mocha.js CHANGED
@@ -4066,7 +4066,8 @@ var EventEmitter = require('browser/events').EventEmitter
4066
4066
  , utils = require('./utils')
4067
4067
  , filter = utils.filter
4068
4068
  , keys = utils.keys
4069
- , noop = function(){};
4069
+ , noop = function(){}
4070
+ , immediately = global.setImmediate || process.nextTick;
4070
4071
 
4071
4072
  /**
4072
4073
  * Non-enumerable globals.
@@ -4246,7 +4247,7 @@ Runner.prototype.fail = function(test, err){
4246
4247
  if ('string' == typeof err) {
4247
4248
  err = new Error('the string "' + err + '" was thrown, throw an Error :)');
4248
4249
  }
4249
-
4250
+
4250
4251
  this.emit('fail', test, err);
4251
4252
  };
4252
4253
 
@@ -4303,7 +4304,7 @@ Runner.prototype.hook = function(name, fn){
4303
4304
  });
4304
4305
  }
4305
4306
 
4306
- process.nextTick(function(){
4307
+ immediately(function(){
4307
4308
  next(0);
4308
4309
  });
4309
4310
  };
@@ -4546,14 +4547,16 @@ Runner.prototype.run = function(fn){
4546
4547
  var self = this
4547
4548
  , fn = fn || function(){};
4548
4549
 
4550
+ function uncaught(err){
4551
+ self.uncaught(err);
4552
+ }
4553
+
4549
4554
  debug('start');
4550
4555
 
4551
4556
  // callback
4552
4557
  this.on('end', function(){
4553
4558
  debug('end');
4554
- process.removeListener('uncaughtException', function(err){
4555
- self.uncaught(err);
4556
- });
4559
+ process.removeListener('uncaughtException', uncaught);
4557
4560
  fn(self.failures);
4558
4561
  });
4559
4562
 
@@ -4565,9 +4568,7 @@ Runner.prototype.run = function(fn){
4565
4568
  });
4566
4569
 
4567
4570
  // uncaught exception
4568
- process.on('uncaughtException', function(err){
4569
- self.uncaught(err);
4570
- });
4571
+ process.on('uncaughtException', uncaught);
4571
4572
 
4572
4573
  return this;
4573
4574
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mocha",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "description": "simple, flexible, fun test framework",
5
5
  "keywords": [
6
6
  "mocha",