Comparing version 1.3.2 to 1.4.0
1.4.0 / 2012-08-22 | ||
================== | ||
* add mkdir -p to `mocha init`. Closes #539 | ||
* add `.only()`. Closes #524 | ||
* add `.skip()`. Closes #524 | ||
* change str.trim() to use utils.trim(). Closes #533 | ||
* fix HTML progress indicator retina display | ||
* fix url-encoding of click-to-grep HTML functionality | ||
1.3.2 / 2012-08-01 | ||
@@ -3,0 +13,0 @@ ================== |
@@ -29,3 +29,3 @@ | ||
suite.on('pre-require', function(context){ | ||
suite.on('pre-require', function(context, file, mocha){ | ||
@@ -65,21 +65,24 @@ /** | ||
/** | ||
* Pending describe. | ||
* Describe a "suite" with the given `title` | ||
* and callback `fn` containing nested suites | ||
* and/or tests. | ||
*/ | ||
context.xdescribe = context.xcontext = function(title, fn){ | ||
context.describe = context.context = function(title, fn){ | ||
var suite = Suite.create(suites[0], title); | ||
suite.pending = true; | ||
suites.unshift(suite); | ||
fn(); | ||
suites.shift(); | ||
return suite; | ||
}; | ||
/** | ||
* Describe a "suite" with the given `title` | ||
* and callback `fn` containing nested suites | ||
* and/or tests. | ||
* Pending describe. | ||
*/ | ||
context.describe = context.context = function(title, fn){ | ||
context.xdescribe = | ||
context.xcontext = | ||
context.describe.skip = function(title, fn){ | ||
var suite = Suite.create(suites[0], title); | ||
suite.pending = true; | ||
suites.unshift(suite); | ||
@@ -91,2 +94,11 @@ fn(); | ||
/** | ||
* Exclusive suite. | ||
*/ | ||
context.describe.only = function(title, fn){ | ||
var suite = context.describe(title, fn); | ||
mocha.grep(suite.fullTitle()); | ||
}; | ||
/** | ||
* Describe a specification or test-case | ||
@@ -100,10 +112,23 @@ * with the given `title` and callback `fn` | ||
if (suite.pending) var fn = null; | ||
suite.addTest(new Test(title, fn)); | ||
var test = new Test(title, fn); | ||
suite.addTest(test); | ||
return test; | ||
}; | ||
/** | ||
* Exclusive test-case. | ||
*/ | ||
context.it.only = function(title, fn){ | ||
var test = context.it(title, fn); | ||
mocha.grep(test.fullTitle()); | ||
}; | ||
/** | ||
* Pending test case. | ||
*/ | ||
context.xit = context.xspecify = function(title){ | ||
context.xit = | ||
context.xspecify = | ||
context.it.skip = function(title){ | ||
context.it(title); | ||
@@ -110,0 +135,0 @@ }; |
@@ -37,3 +37,3 @@ | ||
suite.on('pre-require', function(context){ | ||
suite.on('pre-require', function(context, file, mocha){ | ||
@@ -83,5 +83,15 @@ /** | ||
suites.shift(); | ||
return suite; | ||
}; | ||
/** | ||
* Exclusive test-case. | ||
*/ | ||
context.suite.only = function(title, fn){ | ||
var suite = context.suite(title, fn); | ||
mocha.grep(suite.fullTitle()); | ||
}; | ||
/** | ||
* Describe a specification or test-case | ||
@@ -93,5 +103,16 @@ * with the given `title` and callback `fn` | ||
context.test = function(title, fn){ | ||
suites[0].addTest(new Test(title, fn)); | ||
var test = new Test(title, fn); | ||
suites[0].addTest(test); | ||
return test; | ||
}; | ||
/** | ||
* Exclusive test-case. | ||
*/ | ||
context.test.only = function(title, fn){ | ||
var test = context.test(title, fn); | ||
mocha.grep(test.fullTitle()); | ||
}; | ||
}); | ||
}; |
@@ -120,2 +120,3 @@ /*! | ||
Mocha.prototype.loadFiles = function(fn){ | ||
var self = this; | ||
var suite = this.suite; | ||
@@ -125,5 +126,5 @@ var pending = this.files.length; | ||
file = path.resolve(file); | ||
suite.emit('pre-require', global, file); | ||
suite.emit('require', require(file), file); | ||
suite.emit('post-require', global, file); | ||
suite.emit('pre-require', global, file, self); | ||
suite.emit('require', require(file), file, self); | ||
suite.emit('post-require', global, file, self); | ||
--pending || (fn && fn()); | ||
@@ -130,0 +131,0 @@ }); |
@@ -66,3 +66,9 @@ | ||
if (canvas.getContext) { | ||
var ratio = window.devicePixelRatio || 1; | ||
canvas.style.width = canvas.width; | ||
canvas.style.height = canvas.height; | ||
canvas.width *= ratio; | ||
canvas.height *= ratio; | ||
ctx = canvas.getContext('2d'); | ||
ctx.scale(ratio, ratio); | ||
progress = new Progress; | ||
@@ -94,3 +100,4 @@ } | ||
// suite | ||
var url = location.protocol + '//' + location.host + location.pathname + '?grep=^' + utils.escapeRegexp(suite.fullTitle()); | ||
var grep = '^' + encodeURIComponent(utils.escapeRegexp(suite.fullTitle())); | ||
var url = location.protocol + '//' + location.host + location.pathname + '?grep=' + grep; | ||
var el = fragment('<li class="suite"><h1><a href="%s">%s</a></h1></li>', url, escape(suite.title)); | ||
@@ -97,0 +104,0 @@ |
@@ -207,3 +207,3 @@ | ||
return str.trim(); | ||
return exports.trim(str); | ||
}; | ||
@@ -221,2 +221,14 @@ | ||
return str.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"); | ||
}; | ||
/** | ||
* Trim the given `str`. | ||
* | ||
* @param {String} str | ||
* @return {String} | ||
* @api private | ||
*/ | ||
exports.trim = function(str){ | ||
return str.replace(/^\s+|\s+$/g, ''); | ||
}; |
{ | ||
"name": "mocha" | ||
, "version": "1.3.2" | ||
, "version": "1.4.0" | ||
, "description": "simple, flexible, fun test framework" | ||
@@ -20,2 +20,3 @@ , "keywords": ["test", "bdd", "tdd", "tap"] | ||
, "debug": "*" | ||
, "mkdirp": "0.3.3" | ||
} | ||
@@ -22,0 +23,0 @@ , "devDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
318306
11097
6
59
+ Addedmkdirp@0.3.3
+ Addedmkdirp@0.3.3(transitive)