Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mocha

Package Overview
Dependencies
Maintainers
1
Versions
203
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mocha - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

lib/reporters/nyan.js

10

History.md
1.2.0 / 2012-06-17
==================
* Added `nyan` reporter [Atsuya Takagi]
* Added `mocha init <path>` to copy client files
* Added "specify" synonym for "it" [domenic]
* Added global leak wildcard support [nathanbowser]
* Fixed runner emitter leak. closes #432
* Fixed omission of .js extension. Closes #454
1.1.0 / 2012-05-30

@@ -3,0 +13,0 @@ ==================

2

lib/interfaces/bdd.js

@@ -87,3 +87,3 @@

context.it = function(title, fn){
context.it = context.specify = function(title, fn){
suites[0].addTest(new Test(title, fn));

@@ -90,0 +90,0 @@ };

@@ -1,2 +0,1 @@

/*!

@@ -24,3 +23,3 @@ * mocha

exports.version = '1.1.0';
exports.version = '1.2.0';

@@ -150,7 +149,8 @@ /**

var msg = stats.failures + ' of ' + runner.total + ' tests failed';
notify(msg, { title: 'Failed', image: image('fail') });
notify(msg, { name: 'mocha', title: 'Failed', image: image('error') });
} else {
notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', {
title: 'Passed'
, image: image('pass')
name: 'mocha'
, title: 'Passed'
, image: image('ok')
});

@@ -195,2 +195,2 @@ }

return runner.run(fn);
};
};

@@ -53,23 +53,5 @@

console.log('%s <dt>%s</dt>', indent(), test.title);
var code = utils.escape(clean(test.fn.toString()));
var code = utils.escape(utils.clean(test.fn.toString()));
console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
});
}
/**
* Strip the function definition from `str`,
* and re-indent for pre whitespace.
*/
function clean(str) {
str = str
.replace(/^function *\(.*\) *{/, '')
.replace(/\s+\}$/, '');
var spaces = str.match(/^\n?( *)/)[1].length
, re = new RegExp('^ {' + spaces + '}', 'gm');
str = str.replace(re, '');
return str;
}

@@ -39,2 +39,9 @@

/**
* Return coverage class for `n`.
*
* @return {String}
* @api private
*/
function coverageClass(n) {

@@ -41,0 +48,0 @@ if (n >= 75) return 'high';

@@ -79,3 +79,3 @@

// suite
var url = location.origin + location.pathname + '?grep=^' + utils.escapeRegexp(suite.fullTitle());
var url = location.protocol + '//' + location.host + location.pathname + '?grep=^' + utils.escapeRegexp(suite.fullTitle());
var el = fragment('<li class="suite"><h1><a href="%s">%s</a></h1></li>', url, suite.title);

@@ -147,3 +147,3 @@

if (!test.pending) {
var pre = fragment('<pre><code>%e</code></pre>', clean(test.fn.toString()));
var pre = fragment('<pre><code>%e</code></pre>', utils.clean(test.fn.toString()));
el.appendChild(pre);

@@ -206,22 +206,2 @@ pre.style.display = 'none';

}
}
/**
* Strip the function definition from `str`,
* and re-indent for pre whitespace.
*/
function clean(str) {
str = str
.replace(/^function *\(.*\) *{/, '')
.replace(/\s+\}$/, '');
var spaces = str.match(/^\n?( *)/)[1].length
, re = new RegExp('^ {' + spaces + '}', 'gm');
str = str
.replace(re, '')
.replace(/^\s+/, '');
return str;
}
}

@@ -81,3 +81,3 @@

runner.on('pass', function(test){
var code = clean(test.fn.toString());
var code = utils.clean(test.fn.toString());
buf += test.title + '.\n';

@@ -94,20 +94,2 @@ buf += '\n```js';

});
}
/**
* Strip the function definition from `str`,
* and re-indent for pre whitespace.
*/
function clean(str) {
str = str
.replace(/^function *\(.*\) *{/, '')
.replace(/\s+\}$/, '');
var spaces = str.match(/^\n?( *)/)[1].length
, re = new RegExp('^ {' + spaces + '}', 'gm');
str = str.replace(re, '');
return str;
}

@@ -10,2 +10,4 @@

, utils = require('./utils')
, filter = utils.filter
, keys = utils.keys
, noop = function(){};

@@ -73,3 +75,3 @@

/**
* Returns the number of tests matching the grep search for the
* Returns the number of tests matching the grep search for the
* given suite.

@@ -118,7 +120,4 @@ *

if (this.ignoreLeaks) return;
var leaks = filterLeaks(this._globals);
var leaks = utils.filter(utils.keys(global), function(key){
return !~utils.indexOf(this._globals, key) && (!global.navigator || 'onerror' !== key);
}, this);
this._globals = this._globals.concat(leaks);

@@ -443,6 +442,11 @@

// uncaught callback
function uncaught(err) {
self.uncaught(err);
}
// callback
this.on('end', function(){
debug('end');
process.removeListener('uncaughtException', this.uncaught);
process.removeListener('uncaughtException', uncaught);
fn(self.failures);

@@ -459,7 +463,23 @@ });

// uncaught exception
process.on('uncaughtException', function(err){
self.uncaught(err);
});
process.on('uncaughtException', uncaught);
return this;
};
/**
* Filter leaks with the given globals flagged as `ok`.
*
* @param {Array} ok
* @return {Array}
* @api private
*/
function filterLeaks(ok) {
return filter(keys(global), function(key){
var matched = filter(ok, function(ok){
if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]);
return key == ok;
});
return matched.length == 0 && (!global.navigator || 'onerror' !== key);
});
}

@@ -193,2 +193,20 @@

/**
* Strip the function definition from `str`,
* and re-indent for pre whitespace.
*/
exports.clean = function(str) {
str = str
.replace(/^function *\(.*\) *{/, '')
.replace(/\s+\}$/, '');
var spaces = str.match(/^\n?( *)/)[1].length
, re = new RegExp('^ {' + spaces + '}', 'gm');
str = str.replace(re, '');
return str.trim();
};
/**
* Escape regular expression characters in `str`.

@@ -195,0 +213,0 @@ *

{
"name": "mocha"
, "version": "1.1.0"
, "version": "1.2.0"
, "description": "simple, flexible, fun test framework"

@@ -5,0 +5,0 @@ , "keywords": ["test", "bdd", "tdd", "tap"]

@@ -38,2 +38,5 @@ [![Build Status](https://secure.travis-ci.org/visionmedia/mocha.png)](http://travis-ci.org/visionmedia/mocha)

- [Chai](https://github.com/chaijs/chai) - BDD, TDD, and assert for node & the browser
- [Should.js](http://github.com/visionmedia/should.js) - BDD style assertions for node
- [Expect.js](https://github.com/LearnBoost/expect.js) - BDD style assertions for node & the browser
- [Google Group](http://groups.google.com/group/mochajs)

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc