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.4.1 to 1.4.2

12

History.md
1.4.2 / 2012-09-01
==================
* add support to multiple `Mocha#globals()` calls, and strings
* add `mocha.reporter()` constructor support [joliss]
* add `mocha.timeout()`
* move query-string parser to utils.js
* move highlight code to utils.js
* fix third-party reporter support [exogen]
* fix client-side API to match node-side [jfirebaugh]
* fix mocha in iframe [joliss]
1.4.1 / 2012-08-28

@@ -3,0 +15,0 @@ ==================

41

lib/mocha.js

@@ -70,3 +70,3 @@ /*!

this.reporter(options.reporter);
if (options.timeout) this.suite.timeout(options.timeout);
if (options.timeout) this.timeout(options.timeout);
}

@@ -87,12 +87,20 @@

/**
* Set reporter to `name`, defaults to "dot".
* Set reporter to `reporter`, defaults to "dot".
*
* @param {String} name
* @param {String|Function} reporter name of a reporter or a reporter constructor
* @api public
*/
Mocha.prototype.reporter = function(name){
name = name || 'dot';
this._reporter = require('./reporters/' + name);
if (!this._reporter) throw new Error('invalid reporter "' + name + '"');
Mocha.prototype.reporter = function(reporter){
if ('function' == typeof reporter) {
this._reporter = reporter;
} else {
reporter = reporter || 'dot';
try {
this._reporter = require('./reporters/' + reporter);
} catch (err) {
this._reporter = require(reporter);
}
if (!this._reporter) throw new Error('invalid reporter "' + reporter + '"');
}
return this;

@@ -211,5 +219,5 @@ };

/**
* Ignore `globals`.
* Ignore `globals` array or string.
*
* @param {Array} globals
* @param {Array|String} globals
* @return {Mocha}

@@ -220,3 +228,3 @@ * @api public

Mocha.prototype.globals = function(globals){
this.options.globals = globals;
this.options.globals = (this.options.globals || []).concat(globals);
return this;

@@ -226,2 +234,15 @@ };

/**
* Set the timeout in milliseconds.
*
* @param {Number} timeout
* @return {Mocha}
* @api public
*/
Mocha.prototype.timeout = function(timeout){
this.suite.timeout(timeout);
return this;
};
/**
* Run tests and invoke `fn()` when complete.

@@ -228,0 +249,0 @@ *

@@ -45,3 +45,3 @@

function HTML(runner) {
function HTML(runner, root) {
Base.call(this, runner);

@@ -52,3 +52,2 @@

, total = runner.total
, root = document.getElementById('mocha')
, stat = fragment(statsTemplate)

@@ -67,2 +66,4 @@ , items = stat.getElementsByTagName('li')

root = root || document.getElementById('mocha');
if (canvas.getContext) {

@@ -102,4 +103,3 @@ var ratio = window.devicePixelRatio || 1;

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

@@ -106,0 +106,0 @@

@@ -232,2 +232,55 @@

return str.replace(/^\s+|\s+$/g, '');
};
/**
* Parse the given `qs`.
*
* @param {String} qs
* @return {Object}
* @api private
*/
exports.parseQuery = function(qs){
return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair){
var i = pair.indexOf('=')
, key = pair.slice(0, i)
, val = pair.slice(++i);
obj[key] = decodeURIComponent(val);
return obj;
}, {});
};
/**
* Highlight the given string of `js`.
*
* @param {String} js
* @return {String}
* @api private
*/
function highlight(js) {
return js
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
.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(/\b(function|new|throw|return|var|if|else)\b/gm, '<span class="keyword">$1</span>')
}
/**
* Highlight the contents of tag `name`.
*
* @param {String} name
* @api private
*/
exports.highlightTags = function(name) {
var code = document.getElementsByTagName(name);
for (var i = 0, len = code.length; i < len; ++i) {
code[i].innerHTML = highlight(code[i].innerHTML);
}
};
{
"name": "mocha"
, "version": "1.4.1"
, "version": "1.4.2"
, "description": "simple, flexible, fun test framework"

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

describe('embeds.parse(str, fn)', function(){
describe('bar', function(){
it.only('should something', function(done){
it('should something', function(done){
setTimeout(function(){

@@ -9,3 +9,7 @@ done();

})
it('should asdfasd', function(){
})
})
})

Sorry, the diff of this file is too big to display

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