mocha
Advanced tools
Comparing version 8.3.2 to 8.4.0
@@ -14,2 +14,3 @@ 'use strict'; | ||
const findUp = require('find-up'); | ||
const {createUnparsableFileError} = require('../errors'); | ||
const utils = require('../utils'); | ||
@@ -85,3 +86,6 @@ | ||
} catch (err) { | ||
throw new Error(`failed to parse config "${filepath}": ${err}`); | ||
throw createUnparsableFileError( | ||
`Unable to read/parse ${filepath}: ${err}`, | ||
filepath | ||
); | ||
} | ||
@@ -88,0 +92,0 @@ return config; |
@@ -21,2 +21,3 @@ 'use strict'; | ||
const {isNodeFlag} = require('./node-flags'); | ||
const {createUnparsableFileError} = require('../errors'); | ||
@@ -194,3 +195,6 @@ /** | ||
if (args.package) { | ||
throw new Error(`Unable to read/parse ${filepath}: ${err}`); | ||
throw createUnparsableFileError( | ||
`Unable to read/parse ${filepath}: ${err}`, | ||
filepath | ||
); | ||
} | ||
@@ -197,0 +201,0 @@ debug('failed to read default package.json at %s; ignoring', filepath); |
@@ -264,13 +264,17 @@ 'use strict'; | ||
const run = () => { | ||
mocha = beforeRun ? beforeRun({mocha, watcher}) || mocha : mocha; | ||
runner = mocha.run(() => { | ||
debug('finished watch run'); | ||
runner = null; | ||
blastCache(watcher); | ||
if (rerunScheduled) { | ||
rerun(); | ||
} else { | ||
console.error(`${logSymbols.info} [mocha] waiting for changes...`); | ||
} | ||
}); | ||
try { | ||
mocha = beforeRun ? beforeRun({mocha, watcher}) || mocha : mocha; | ||
runner = mocha.run(() => { | ||
debug('finished watch run'); | ||
runner = null; | ||
blastCache(watcher); | ||
if (rerunScheduled) { | ||
rerun(); | ||
} else { | ||
console.error(`${logSymbols.info} [mocha] waiting for changes...`); | ||
} | ||
}); | ||
} catch (e) { | ||
console.error(e.stack); | ||
} | ||
}; | ||
@@ -277,0 +281,0 @@ |
@@ -166,3 +166,10 @@ 'use strict'; | ||
*/ | ||
TIMEOUT: 'ERR_MOCHA_TIMEOUT' | ||
TIMEOUT: 'ERR_MOCHA_TIMEOUT', | ||
/** | ||
* Input file is not able to be parsed | ||
* @constant | ||
* @default | ||
*/ | ||
UNPARSABLE_FILE: 'ERR_MOCHA_UNPARSABLE_FILE' | ||
}; | ||
@@ -500,2 +507,16 @@ | ||
/** | ||
* Creates an error object to be thrown when file is unparsable | ||
* @public | ||
* @static | ||
* @param {string} message - Error message to be displayed. | ||
* @param {string} filename - File name | ||
* @returns {Error} Error with code {@link constants.UNPARSABLE_FILE} | ||
*/ | ||
function createUnparsableFileError(message, filename) { | ||
var err = new Error(message); | ||
err.code = constants.UNPARSABLE_FILE; | ||
return err; | ||
} | ||
/** | ||
* Returns `true` if an error came out of Mocha. | ||
@@ -530,2 +551,3 @@ * _Can suffer from false negatives, but not false positives._ | ||
createTimeoutError, | ||
createUnparsableFileError, | ||
createUnsupportedError, | ||
@@ -532,0 +554,0 @@ deprecate, |
@@ -108,9 +108,2 @@ 'use strict'; | ||
}; | ||
/** | ||
* Number of attempts to retry. | ||
*/ | ||
context.it.retries = function(n) { | ||
context.retries(n); | ||
}; | ||
}); | ||
@@ -117,0 +110,0 @@ }; |
@@ -190,11 +190,2 @@ 'use strict'; | ||
context.test(title); | ||
}, | ||
/** | ||
* Number of retry attempts | ||
* | ||
* @param {number} n | ||
*/ | ||
retries: function(n) { | ||
context.retries(n); | ||
} | ||
@@ -201,0 +192,0 @@ } |
@@ -95,3 +95,2 @@ 'use strict'; | ||
context.test.skip = common.test.skip; | ||
context.test.retries = common.test.retries; | ||
}); | ||
@@ -98,0 +97,0 @@ }; |
@@ -102,3 +102,2 @@ 'use strict'; | ||
context.test.skip = common.test.skip; | ||
context.test.retries = common.test.retries; | ||
}); | ||
@@ -105,0 +104,0 @@ }; |
@@ -183,6 +183,6 @@ 'use strict'; | ||
* @param {string} [options.ui] - Interface name. | ||
* @param {boolean} [options.parallel] - Run jobs in parallel | ||
* @param {number} [options.jobs] - Max number of worker processes for parallel runs | ||
* @param {MochaRootHookObject} [options.rootHooks] - Hooks to bootstrap the root | ||
* suite with | ||
* @param {boolean} [options.parallel] - Run jobs in parallel. | ||
* @param {number} [options.jobs] - Max number of worker processes for parallel runs. | ||
* @param {MochaRootHookObject} [options.rootHooks] - Hooks to bootstrap the root suite with. | ||
* @param {string[]} [options.require] - Pathname of `rootHooks` plugin for parallel runs. | ||
* @param {boolean} [options.isWorker] - Should be `true` if `Mocha` process is running in a worker process. | ||
@@ -189,0 +189,0 @@ */ |
{ | ||
"name": "mocha", | ||
"version": "8.3.2", | ||
"version": "8.4.0", | ||
"description": "simple, flexible, fun test framework", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -12,4 +12,4 @@ <p align="center"> | ||
<a href="https://gitter.im/mochajs/mocha?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img src="https://badges.gitter.im/Join%20Chat.svg" alt="Gitter"></a> | ||
<a href="https://github.com/mochajs/mocha#backers"><img src="https://opencollective.com/mochajs/backers/badge.svg" alt="OpenCollective"></a> | ||
<a href="https://github.com/mochajs/mocha#sponsors"><img src="https://opencollective.com/mochajs/sponsors/badge.svg" alt="OpenCollective"></a> | ||
<a href="https://github.com/mochajs/mocha#sponsors"><img src="https://opencollective.com/mochajs/tiers/sponsors/badge.svg" alt="OpenCollective"></a> | ||
<a href="https://github.com/mochajs/mocha#backers"><img src="https://opencollective.com/mochajs/tiers/backers/badge.svg" alt="OpenCollective"></a> | ||
</p> | ||
@@ -31,3 +31,2 @@ | ||
- [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) | ||
@@ -37,59 +36,14 @@ | ||
[Become a backer](https://opencollective.com/mochajs#backer) and show your support to our open source project. | ||
[Become a backer](https://opencollective.com/mochajs) and show your support to our open source project on [our site](https://mochajs.org/#backers). | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/0/avatar)](https://opencollective.com/mochajs/backer/0/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/1/avatar)](https://opencollective.com/mochajs/backer/1/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/2/avatar)](https://opencollective.com/mochajs/backer/2/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/3/avatar)](https://opencollective.com/mochajs/backer/3/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/4/avatar)](https://opencollective.com/mochajs/backer/4/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/5/avatar)](https://opencollective.com/mochajs/backer/5/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/6/avatar)](https://opencollective.com/mochajs/backer/6/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/7/avatar)](https://opencollective.com/mochajs/backer/7/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/8/avatar)](https://opencollective.com/mochajs/backer/8/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/9/avatar)](https://opencollective.com/mochajs/backer/9/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/10/avatar)](https://opencollective.com/mochajs/backer/10/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/11/avatar)](https://opencollective.com/mochajs/backer/11/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/12/avatar)](https://opencollective.com/mochajs/backer/12/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/13/avatar)](https://opencollective.com/mochajs/backer/13/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/14/avatar)](https://opencollective.com/mochajs/backer/14/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/15/avatar)](https://opencollective.com/mochajs/backer/15/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/16/avatar)](https://opencollective.com/mochajs/backer/16/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/17/avatar)](https://opencollective.com/mochajs/backer/17/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/18/avatar)](https://opencollective.com/mochajs/backer/18/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/19/avatar)](https://opencollective.com/mochajs/backer/19/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/20/avatar)](https://opencollective.com/mochajs/backer/20/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/21/avatar)](https://opencollective.com/mochajs/backer/21/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/22/avatar)](https://opencollective.com/mochajs/backer/22/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/23/avatar)](https://opencollective.com/mochajs/backer/23/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/24/avatar)](https://opencollective.com/mochajs/backer/24/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/25/avatar)](https://opencollective.com/mochajs/backer/25/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/26/avatar)](https://opencollective.com/mochajs/backer/26/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/27/avatar)](https://opencollective.com/mochajs/backer/27/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/28/avatar)](https://opencollective.com/mochajs/backer/28/website) | ||
[![MochaJS Backer](https://opencollective.com/mochajs/backer/29/avatar)](https://opencollective.com/mochajs/backer/29/website) | ||
<a href="https://opencollective.com/mochajs"><img src="https://opencollective.com/mochajs/tiers/backers.svg?limit=30&button=false&avatarHeight=46&width=750"></a> | ||
## Sponsors | ||
Does your company use Mocha? Ask your manager or marketing team if your company would be interested in supporting our project. Support will allow the maintainers to dedicate more time for maintenance and new features for everyone. Also, your company's logo will show [on GitHub](https://github.com/mochajs/mocha#readme) and on [our site](https://mochajs.org) - who doesn't want a little extra exposure? [Here's the info](https://opencollective.com/mochajs#sponsor). | ||
Does your company use Mocha? Ask your manager or marketing team if your company would be interested in supporting our project. Support will allow the maintainers to dedicate more time for maintenance and new features for everyone. Also, your company's logo will show [on GitHub](https://github.com/mochajs/mocha#readme) and on [our site](https://mochajs.org#sponsors) - who doesn't want a little extra exposure? [Here's the info](https://opencollective.com/mochajs). | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/0/avatar)](https://opencollective.com/mochajs/sponsor/0/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/1/avatar)](https://opencollective.com/mochajs/sponsor/1/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/2/avatar)](https://opencollective.com/mochajs/sponsor/2/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/3/avatar)](https://opencollective.com/mochajs/sponsor/3/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/4/avatar)](https://opencollective.com/mochajs/sponsor/4/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/5/avatar)](https://opencollective.com/mochajs/sponsor/5/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/6/avatar)](https://opencollective.com/mochajs/sponsor/6/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/7/avatar)](https://opencollective.com/mochajs/sponsor/7/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/8/avatar)](https://opencollective.com/mochajs/sponsor/8/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/9/avatar)](https://opencollective.com/mochajs/sponsor/9/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/10/avatar)](https://opencollective.com/mochajs/sponsor/10/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/11/avatar)](https://opencollective.com/mochajs/sponsor/11/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/12/avatar)](https://opencollective.com/mochajs/sponsor/12/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/13/avatar)](https://opencollective.com/mochajs/sponsor/13/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/14/avatar)](https://opencollective.com/mochajs/sponsor/14/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/15/avatar)](https://opencollective.com/mochajs/sponsor/15/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/16/avatar)](https://opencollective.com/mochajs/sponsor/16/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/17/avatar)](https://opencollective.com/mochajs/sponsor/17/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/18/avatar)](https://opencollective.com/mochajs/sponsor/18/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/sponsor/19/avatar)](https://opencollective.com/mochajs/sponsor/19/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/tiers/sponsors/0/avatar)](https://opencollective.com/mochajs/tiers/sponsors/0/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/tiers/sponsors/1/avatar)](https://opencollective.com/mochajs/tiers/sponsors/1/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/tiers/sponsors/2/avatar)](https://opencollective.com/mochajs/tiers/sponsors/2/website) | ||
[![MochaJS Sponsor](https://opencollective.com/mochajs/tiers/sponsors/3/avatar)](https://opencollective.com/mochajs/tiers/sponsors/3/website) | ||
@@ -100,3 +54,3 @@ ## Development | ||
- 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 one of the _most-depended-upon_ modules 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. | ||
@@ -103,0 +57,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
37789
3069049
71