Socket
Socket
Sign inDemoInstall

mocha

Package Overview
Dependencies
Maintainers
1
Versions
199
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 5.0.1 to 5.0.2

2

lib/reporters/base.js

@@ -305,3 +305,3 @@ 'use strict';

runner.on('end', function () {
runner.once('end', function () {
stats.end = new Date();

@@ -308,0 +308,0 @@ stats.duration = stats.end - stats.start;

@@ -59,3 +59,3 @@ 'use strict';

runner.on('end', function () {
runner.once('end', function () {
console.log();

@@ -62,0 +62,0 @@ self.epilogue();

@@ -42,3 +42,3 @@ 'use strict';

runner.on('end', function () {
runner.once('end', function () {
process.stdout.write(JSON.stringify(['end', self.stats]));

@@ -45,0 +45,0 @@ });

@@ -46,3 +46,3 @@ 'use strict';

runner.on('end', function () {
runner.once('end', function () {
var obj = {

@@ -49,0 +49,0 @@ stats: self.stats,

@@ -84,3 +84,3 @@ 'use strict';

runner.on('end', function () {
runner.once('end', function () {
cursor.show();

@@ -87,0 +87,0 @@ console.log();

@@ -57,3 +57,3 @@ 'use strict';

runner.on('end', self.epilogue.bind(self));
runner.once('end', self.epilogue.bind(self));
}

@@ -60,0 +60,0 @@

@@ -94,3 +94,3 @@ 'use strict';

runner.on('end', function () {
runner.once('end', function () {
process.stdout.write('# TOC\n');

@@ -97,0 +97,0 @@ process.stdout.write(generateTOC(runner.suite));

@@ -32,3 +32,3 @@ 'use strict';

runner.on('end', this.epilogue.bind(this));
runner.once('end', this.epilogue.bind(this));
}

@@ -35,0 +35,0 @@

@@ -55,3 +55,3 @@ 'use strict';

runner.on('end', function () {
runner.once('end', function () {
Base.cursor.show();

@@ -58,0 +58,0 @@ for (var i = 0; i < self.numberOfLines; i++) {

@@ -83,3 +83,3 @@ 'use strict';

// and the failures if any
runner.on('end', function () {
runner.once('end', function () {
cursor.show();

@@ -86,0 +86,0 @@ console.log();

@@ -75,3 +75,3 @@ 'use strict';

runner.on('end', self.epilogue.bind(self));
runner.once('end', self.epilogue.bind(self));
}

@@ -78,0 +78,0 @@

@@ -54,3 +54,3 @@ 'use strict';

runner.on('end', function () {
runner.once('end', function () {
console.log('# tests ' + (passes + failures));

@@ -57,0 +57,0 @@ console.log('# pass ' + passes);

@@ -81,3 +81,3 @@ 'use strict';

runner.on('end', function () {
runner.once('end', function () {
self.write(tag('testsuite', {

@@ -84,0 +84,0 @@ name: suiteName,

@@ -146,2 +146,20 @@ 'use strict';

/**
* Return `true` if this Runnable has failed.
* @return {boolean}
* @private
*/
Runnable.prototype.isFailed = function () {
return !this.isPending() && this.state === 'failed';
};
/**
* Return `true` if this Runnable has passed.
* @return {boolean}
* @private
*/
Runnable.prototype.isPassed = function () {
return !this.isPending() && this.state === 'passed';
};
/**
* Set or get number of retries.

@@ -148,0 +166,0 @@ *

@@ -729,17 +729,21 @@ 'use strict';

// Ignore errors if complete or pending
if (runnable.state || runnable.isPending()) {
// Ignore errors if already failed or pending
// See #3226
if (runnable.isFailed() || runnable.isPending()) {
return;
}
// we cannot recover gracefully if a Runnable has already passed
// then fails asynchronously
var alreadyPassed = runnable.isPassed();
// this will change the state to "failed" regardless of the current value
this.fail(runnable, err);
if (!alreadyPassed) {
// recover from test
if (runnable.type === 'test') {
this.emit('test end', runnable);
this.hookUp('afterEach', this.next);
return;
}
// recover from test
if (runnable.type === 'test') {
this.emit('test end', runnable);
this.hookUp('afterEach', this.next);
return;
}
// recover from hooks
if (runnable.type === 'hook') {
// recover from hooks
var errSuite = this.suite;

@@ -746,0 +750,0 @@ // if hook failure is in afterEach block

'use strict';
/* eslint-env browser */
/**

@@ -9,20 +7,8 @@ * Module dependencies.

var basename = require('path').basename;
var debug = require('debug')('mocha:watch');
var exists = require('fs').existsSync;
var fs = require('fs');
var glob = require('glob');
var path = require('path');
var join = path.join;
var readdirSync = require('fs').readdirSync;
var statSync = require('fs').statSync;
var watchFile = require('fs').watchFile;
var lstatSync = require('fs').lstatSync;
var he = require('he');
/**
* Ignored directories.
*/
var ignore = ['node_modules', '.git'];
exports.inherits = require('util').inherits;

@@ -64,3 +50,3 @@

debug('file %s', file);
watchFile(file, options, function (curr, prev) {
fs.watchFile(file, options, function (curr, prev) {
if (prev.mtime < curr.mtime) {

@@ -74,42 +60,2 @@ fn(file);

/**
* Ignored files.
*
* @api private
* @param {string} path
* @return {boolean}
*/
function ignored (path) {
return !~ignore.indexOf(path);
}
/**
* Lookup files in the given `dir`.
*
* @api private
* @param {string} dir
* @param {string[]} [ext=['.js']]
* @param {Array} [ret=[]]
* @return {Array}
*/
exports.files = function (dir, ext, ret) {
ret = ret || [];
ext = ext || ['js'];
var re = new RegExp('\\.(' + ext.join('|') + ')$');
readdirSync(dir)
.filter(ignored)
.forEach(function (path) {
path = join(dir, path);
if (lstatSync(path).isDirectory()) {
exports.files(path, ext, ret);
} else if (path.match(re)) {
ret.push(path);
}
});
return ret;
};
/**
* Compute a slug from the given `str`.

@@ -475,3 +421,3 @@ *

* @api public
* @param {string} path Base path to start searching from.
* @param {string} filepath Base path to start searching from.
* @param {string[]} extensions File extensions to look for.

@@ -481,12 +427,12 @@ * @param {boolean} recursive Whether or not to recurse into subdirectories.

*/
exports.lookupFiles = function lookupFiles (path, extensions, recursive) {
exports.lookupFiles = function lookupFiles (filepath, extensions, recursive) {
var files = [];
if (!exists(path)) {
if (exists(path + '.js')) {
path += '.js';
if (!fs.existsSync(filepath)) {
if (fs.existsSync(filepath + '.js')) {
filepath += '.js';
} else {
files = glob.sync(path);
files = glob.sync(filepath);
if (!files.length) {
throw new Error("cannot resolve path (or pattern) '" + path + "'");
throw new Error("cannot resolve path (or pattern) '" + filepath + "'");
}

@@ -498,5 +444,5 @@ return files;

try {
var stat = statSync(path);
var stat = fs.statSync(filepath);
if (stat.isFile()) {
return path;
return filepath;
}

@@ -508,6 +454,6 @@ } catch (err) {

readdirSync(path).forEach(function (file) {
file = join(path, file);
fs.readdirSync(filepath).forEach(function (file) {
file = path.join(filepath, file);
try {
var stat = statSync(file);
var stat = fs.statSync(file);
if (stat.isDirectory()) {

@@ -524,3 +470,3 @@ if (recursive) {

var re = new RegExp('\\.(?:' + extensions.join('|') + ')$');
if (!stat.isFile() || !re.test(file) || basename(file)[0] === '.') {
if (!stat.isFile() || !re.test(file) || path.basename(file)[0] === '.') {
return;

@@ -608,3 +554,3 @@ }

if (/\(?.+:\d+:\d+\)?$/.test(line)) {
line = line.replace(cwd, '');
line = line.replace('(' + cwd, '(');
}

@@ -611,0 +557,0 @@

{
"name": "mocha",
"version": "5.0.1",
"version": "5.0.2",
"description": "simple, flexible, fun test framework",

@@ -309,3 +309,3 @@ "keywords": [

"dependencies": {
"browser-stdout": "1.3.0",
"browser-stdout": "1.3.1",
"commander": "2.11.0",

@@ -312,0 +312,0 @@ "debug": "3.1.0",

@@ -1,37 +0,1 @@

# Mocha needs YOU!
*Did you know* Mocha [is a dependency of over 100,000 projects](https://libraries.io/npm/mocha) published to npm alone?
**Despite this, we're currently unable to merge most pull requests due to lack of maintenance resources.**
**Are you interested in triaging issues or reviewing open PRs? Have some time to hack on its codebase?** If you would like to help maintain Mocha, please contact `@boneskull` on [Gitter](https://gitter.im/mochajs/mocha).
*Thank you* :kissing_heart: to all of you interested in helping. These are Mocha's immediate needs:
1. Increase test coverage on Node.js and browser
- Increase integration coverage for all reporters
- `html` reporter must be tested in browser
- ~~Basic console reporters (*not* `nyan`, `landing`, etc.) must be tested in **both** browser and Node.js contexts~~
- ~~Filesystem-based reporters must be tested in Node.js context~~
- **UPDATE - May 24 2017**: Thanks to [community contributions](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md#mag-coverage), the coverage on most reporters has increased dramatically! The `html` reporter is still in [dire need of coverage](https://coveralls.io/builds/11674428/source?filename=lib%2Freporters%2Fhtml.js).
- Increase coverage against all interfaces (`exports` in particular). Ideally this becomes a "matrix" where we repeat sets of integration tests across all interfaces.
- Refactor non-Node.js-specific tests to allow them to run in a browser context. Node.js-specific tests include those which *require* the CLI or filesystem. Most everything else is fair game.
1. Review current open pull requests
- We need individuals familiar with Mocha's codebase. Got questions? Ask them in [our chat room](https://gitter.im/mochajs/mocha).
- Pull requests **must** have supporting tests. The only exceptions are pure cosmetic or non-functional changes.
- Pull request contributors must sign [the CLA](https://cla.js.foundation/mochajs/mocha).
1. Close old, inactive issues and pull requests
- ~~A bot should do this. We need a bot. Got a bot?~~ We now use GitHub's own [probot-stale](https://www.npmjs.com/package/probot-stale).
1. Triage issues
- If we run into "critical" bugs, they need fixing.
- "Critical" means Mocha is broken w/o workarounds for a *large percentage* of users
- Otherwise: respond to issues, close new dupe issues, confirm bugs, ask for more info, etc.
Once we gain ground on the above items, we can work together formalize our contribution guidelines and governance. For further info & ideas, please see our [projects](https://github.com/mochajs/mocha/projects/).
*You needn't be a maintainer to submit a pull request for test coverage!*
-- @boneskull, *Jan 17 2016*
<br><br>
<p align="center">

@@ -50,7 +14,8 @@ <img src="https://cldup.com/xFVFxOioAU.svg" alt="Mocha test framework"/>

- [Documentation](http://mochajs.org)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Google Group](http://groups.google.com/group/mochajs)
- [Wiki](https://github.com/mochajs/mocha/wiki)
- Mocha [Extensions and reporters](https://github.com/mochajs/mocha/wiki)
- **[Documentation](https://mochajs.org)**
- **[Release Notes / History / Changes](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)**
- [Code of Conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md)
- [Gitter Chatroom](https://gitter.im/mochajs/mocha) (ask questions here!)
- [Google Group](https://groups.google.com/group/mochajs)
- [Issue Tracker](https://github.com/mochajs/mocha/issues)

@@ -117,2 +82,21 @@ ## Backers

## Development
You might want to know that:
- Mocha is the *most-depended-upon* module on npm (source: [libraries.io](https://libraries.io/search?order=desc&platforms=NPM&sort=dependents_count)), and
- Mocha is an *independent* open-source project, maintained exclusively by volunteers.
You might want to help:
- New to contributing to Mocha? Check out this list of [good first issues](https://github.com/mochajs/mocha/issues?q=is%3Aissue+is%3Aopen+label%3Agood-first-issue)
- Mocha could use a hand with [these issues](https://github.com/mochajs/mocha/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
- The [maintainer's handbook](https://github.com/mochajs/mocha/blob/master/MAINTAINERS.md) explains how things get done
Finally, come [chat with the maintainers](https://gitter.im/mochajs/contributors) on Gitter if you want to help with:
- Triaging issues, answering questions
- Review, merging, and closing pull requests
- Other project-maintenance-y things
## License

@@ -119,0 +103,0 @@

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