[Pkg-javascript-commits] [node-mocha] 01/03: Imported Upstream version 1.20.0

Leo Iannacone l3on-guest at moszumanska.debian.org
Sat May 31 11:41:08 UTC 2014


This is an automated email from the git hooks/post-receive script.

l3on-guest pushed a commit to branch master
in repository node-mocha.

commit d8ac9b4a28ae1519265ae907c05379f0e29107ba
Author: Leo Iannacone <l3on at ubuntu.com>
Date:   Sat May 31 13:39:11 2014 +0200

    Imported Upstream version 1.20.0
---
 History.md                 | 17 +++++++++++++++++
 bin/_mocha                 |  7 +++++++
 bower.json                 |  2 +-
 component.json             |  2 +-
 lib/interfaces/bdd.js      |  2 ++
 lib/interfaces/exports.js  |  6 ++++--
 lib/interfaces/qunit.js    |  2 ++
 lib/interfaces/tdd.js      |  2 ++
 lib/reporters/json.js      | 17 +++++++++--------
 lib/runner.js              |  1 -
 lib/suite.js               |  6 ++++--
 lib/utils.js               |  2 +-
 mocha.js                   |  6 ++++--
 package.json               | 14 +++++++++++---
 support/tail.js            |  4 ++--
 test/acceptance/context.js | 43 ++++++++++++++++++++++++++++++++++++++++++-
 16 files changed, 109 insertions(+), 24 deletions(-)

diff --git a/History.md b/History.md
index 4dfac22..2724b0f 100644
--- a/History.md
+++ b/History.md
@@ -1,3 +1,20 @@
+1.20.0 / 2014-05-28
+==================
+
+  * add: filenames to suite objects (#1222)
+
+1.19.0 / 2014-05-17
+==================
+
+  * add: browser script option to package.json
+  * add: export file in Mocha.Test objects (#1174)
+  * add: add docs for wrapped node flags
+  * fix: mocha.run() to return error status in browser (#1216)
+  * fix: clean() to show failure details (#1205)
+  * fix: regex that generates html for new keyword (#1201)
+  * fix: sibling suites have inherited but separate contexts (#1164)
+
+
 1.18.2 / 2014-03-18
 ==================
 
diff --git a/bin/_mocha b/bin/_mocha
index bea6df8..cc9b06c 100755
--- a/bin/_mocha
+++ b/bin/_mocha
@@ -79,6 +79,13 @@ program
   .option('--recursive', 'include sub directories')
   .option('--debug-brk', "enable node's debugger breaking on the first line")
   .option('--globals <names>', 'allow the given comma-delimited global [names]', list, [])
+  .option('--harmony', 'enable all harmony features (except typeof)')
+  .option('--harmony-proxies', 'enable harmony proxies')
+  .option('--harmony-collections', 'enable harmony collections (sets, maps, and weak maps)')
+  .option('--harmony-generators', 'enable harmony generators')
+  .option('--prof', 'log statistical profiling information')
+  .option('-gc', '--expose-gc', 'expose gc extension')
+  .option('--trace', 'trace function calls')
   .option('--check-leaks', 'check for global variable leaks')
   .option('--interfaces', 'display available interfaces')
   .option('--reporters', 'display available reporters')
diff --git a/bower.json b/bower.json
index 84fc438..0660904 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
 {
   "name": "mocha",
-  "version": "1.18.2",
+  "version": "1.20.0",
   "main": "mocha.js",
   "ignore": [
     "bin",
diff --git a/component.json b/component.json
index ea95f8c..59d08a3 100644
--- a/component.json
+++ b/component.json
@@ -1,6 +1,6 @@
 {
   "name": "mocha",
-  "version": "1.18.2",
+  "version": "1.20.0",
   "repo": "visionmedia/mocha",
   "description": "simple, flexible, fun test framework",
   "keywords": [
diff --git a/lib/interfaces/bdd.js b/lib/interfaces/bdd.js
index e1581da..ebf6f0f 100644
--- a/lib/interfaces/bdd.js
+++ b/lib/interfaces/bdd.js
@@ -69,6 +69,7 @@ module.exports = function(suite){
 
     context.describe = context.context = function(title, fn){
       var suite = Suite.create(suites[0], title);
+      suite.file = file;
       suites.unshift(suite);
       fn.call(suite);
       suites.shift();
@@ -109,6 +110,7 @@ module.exports = function(suite){
       var suite = suites[0];
       if (suite.pending) var fn = null;
       var test = new Test(title, fn);
+      test.file = file;
       suite.addTest(test);
       return test;
     };
diff --git a/lib/interfaces/exports.js b/lib/interfaces/exports.js
index 6b229c0..d933274 100644
--- a/lib/interfaces/exports.js
+++ b/lib/interfaces/exports.js
@@ -28,7 +28,7 @@ module.exports = function(suite){
 
   suite.on('require', visit);
 
-  function visit(obj) {
+  function visit(obj, file) {
     var suite;
     for (var key in obj) {
       if ('function' == typeof obj[key]) {
@@ -47,7 +47,9 @@ module.exports = function(suite){
             suites[0].afterEach(fn);
             break;
           default:
-            suites[0].addTest(new Test(key, fn));
+            var test = new Test(key, fn);
+            test.file = file;
+            suites[0].addTest(test);
         }
       } else {
         var suite = Suite.create(suites[0], key);
diff --git a/lib/interfaces/qunit.js b/lib/interfaces/qunit.js
index a1150c3..02d5007 100644
--- a/lib/interfaces/qunit.js
+++ b/lib/interfaces/qunit.js
@@ -76,6 +76,7 @@ module.exports = function(suite){
     context.suite = function(title){
       if (suites.length > 1) suites.shift();
       var suite = Suite.create(suites[0], title);
+      suite.file = file;
       suites.unshift(suite);
       return suite;
     };
@@ -97,6 +98,7 @@ module.exports = function(suite){
 
     context.test = function(title, fn){
       var test = new Test(title, fn);
+      test.file = file;
       suites[0].addTest(test);
       return test;
     };
diff --git a/lib/interfaces/tdd.js b/lib/interfaces/tdd.js
index f5b78e0..6d0c3d6 100644
--- a/lib/interfaces/tdd.js
+++ b/lib/interfaces/tdd.js
@@ -77,6 +77,7 @@ module.exports = function(suite){
 
     context.suite = function(title, fn){
       var suite = Suite.create(suites[0], title);
+      suite.file = file;
       suites.unshift(suite);
       fn.call(suite);
       suites.shift();
@@ -113,6 +114,7 @@ module.exports = function(suite){
       var suite = suites[0];
       if (suite.pending) var fn = null;
       var test = new Test(title, fn);
+      test.file = file;
       suite.addTest(test);
       return test;
     };
diff --git a/lib/reporters/json.js b/lib/reporters/json.js
index a699f50..e202692 100644
--- a/lib/reporters/json.js
+++ b/lib/reporters/json.js
@@ -42,10 +42,10 @@ function JSONReporter(runner) {
 
   runner.on('end', function(){
     var obj = {
-        stats: self.stats
-      , tests: tests.map(clean)
-      , failures: failures.map(clean)
-      , passes: passes.map(clean)
+      stats: self.stats,
+      tests: tests.map(clean),
+      failures: failures.map(clean),
+      passes: passes.map(clean)
     };
 
     process.stdout.write(JSON.stringify(obj, null, 2));
@@ -63,8 +63,9 @@ function JSONReporter(runner) {
 
 function clean(test) {
   return {
-      title: test.title
-    , fullTitle: test.fullTitle()
-    , duration: test.duration
+    title: test.title,
+    fullTitle: test.fullTitle(),
+    duration: test.duration,
+    err: test.err
   }
-}
\ No newline at end of file
+}
diff --git a/lib/runner.js b/lib/runner.js
index deb442e..a56e530 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -161,7 +161,6 @@ Runner.prototype.checkGlobals = function(test){
   var ok = this._globals;
 
   var globals = this.globalProps();
-  var isNode = process.kill;
   var leaks;
 
   if (test) {
diff --git a/lib/suite.js b/lib/suite.js
index d403a83..b06645b 100644
--- a/lib/suite.js
+++ b/lib/suite.js
@@ -46,9 +46,11 @@ exports.create = function(parent, title){
  * @api private
  */
 
-function Suite(title, ctx) {
+function Suite(title, parentContext) {
   this.title = title;
-  this.ctx = ctx;
+  var context = function() {};
+  context.prototype = parentContext;
+  this.ctx = new context();
   this.suites = [];
   this.tests = [];
   this.pending = false;
diff --git a/lib/utils.js b/lib/utils.js
index 37fd5d7..b0f67fe 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -280,7 +280,7 @@ function highlight(js) {
     .replace(/('.*?')/gm, '<span class="string">$1</span>')
     .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
     .replace(/(\d+)/gm, '<span class="number">$1</span>')
-    .replace(/\bnew *(\w+)/gm, '<span class="keyword">new</span> <span class="init">$1</span>')
+    .replace(/\bnew[ \t]+(\w+)/gm, '<span class="keyword">new</span> <span class="init">$1</span>')
     .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '<span class="keyword">$1</span>')
 }
 
diff --git a/mocha.js b/mocha.js
index 9c85199..19edc87 100644
--- a/mocha.js
+++ b/mocha.js
@@ -5065,9 +5065,11 @@ exports.create = function(parent, title){
  * @api private
  */
 
-function Suite(title, ctx) {
+function Suite(title, parentContext) {
   this.title = title;
-  this.ctx = ctx;
+  var context = function () {};
+  context.prototype = parentContext;
+  this.ctx = new context();
   this.suites = [];
   this.tests = [];
   this.pending = false;
diff --git a/package.json b/package.json
index 8349114..8a20af7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "mocha",
-  "version": "1.18.2",
+  "version": "1.20.0",
   "description": "simple, flexible, fun test framework",
   "keywords": [
     "mocha",
@@ -15,6 +15,7 @@
     "url": "git://github.com/visionmedia/mocha.git"
   },
   "main": "./index",
+  "browser": "./mocha.js",
   "bin": {
     "mocha": "./bin/mocha",
     "_mocha": "./bin/_mocha"
@@ -44,6 +45,13 @@
     "lib",
     "index.js",
     "mocha.css",
-    "mocha.js"
-  ]
+    "mocha.js",
+    "LICENSE"
+  ],
+  "licenses": [
+      {
+        "type": "MIT",
+        "url": "https://raw.github.com/visionmedia/mocha/master/LICENSE"
+      }
+    ]
 }
diff --git a/support/tail.js b/support/tail.js
index 018add8..999d38d 100644
--- a/support/tail.js
+++ b/support/tail.js
@@ -135,12 +135,12 @@ mocha.run = function(fn){
   if (query.grep) mocha.grep(query.grep);
   if (query.invert) mocha.invert();
 
-  return Mocha.prototype.run.call(mocha, function(){
+  return Mocha.prototype.run.call(mocha, function(err){
     // The DOM Document is not available in Web Workers.
     if (global.document) {
       Mocha.utils.highlightTags('code');
     }
-    if (fn) fn();
+    if (fn) fn(err);
   });
 };
 
diff --git a/test/acceptance/context.js b/test/acceptance/context.js
index e2af9d5..0d39f14 100644
--- a/test/acceptance/context.js
+++ b/test/acceptance/context.js
@@ -23,4 +23,45 @@ describe('Context', function(){
   after(function(){
     this.calls.should.eql(['before', 'before two', 'test', 'after two']);
   })
-})
\ No newline at end of file
+})
+
+describe('Context Siblings', function(){
+  beforeEach(function(){
+    this.calls = ['before'];
+  })
+
+  describe('sequestered sibling', function(){
+    beforeEach(function(){
+      this.calls.push('before two');
+      this.hiddenFromSibling = 'This should be hidden';
+    })
+
+    it('should work', function(){
+      this.hiddenFromSibling.should.eql('This should be hidden')
+    })
+  })
+
+  describe('sibling verifiction', function(){
+    beforeEach(function(){
+      this.calls.push('before sibling');
+    })
+
+    it('should not have value set within a sibling describe', function(){
+      'This should be hidden'.should.not.eql(this.hiddenFromSibling);
+      this.visibleFromTestSibling = 'Visible from test sibling';
+    })
+
+    it('should allow test siblings to modify shared context', function(){
+      'Visible from test sibling'.should.eql(this.visibleFromTestSibling);
+    })
+
+    it('should have reset this.calls before describe', function(){
+      this.calls.should.eql(['before', 'before sibling']);
+    })
+  })
+
+  after(function(){
+    this.calls.should.eql(['before', 'before sibling']);
+  })
+
+})

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-mocha.git



More information about the Pkg-javascript-commits mailing list