โ๏ธ Simple, flexible, fun JavaScript test framework for Node.js & The Browser โ๏ธ
-
+
+

+

+

+[](https://github.com/collective-funds/guidelines)
+
+
## Links
- **[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)
-- [Contributing](https://github.com/mochajs/mocha/blob/master/.github/CONTRIBUTING.md)
-- [Development](https://github.com/mochajs/mocha/blob/master/.github/DEVELOPMENT.md)
+- **[Release Notes / History / Changes](https://github.com/mochajs/mocha/blob/main/CHANGELOG.md)**
+- [Code of Conduct](https://github.com/mochajs/mocha/blob/main/.github/CODE_OF_CONDUCT.md)
+- [Contributing](https://github.com/mochajs/mocha/blob/main/.github/CONTRIBUTING.md)
+- [Development](https://github.com/mochajs/mocha/blob/main/.github/DEVELOPMENT.md)
- [Discord](https://discord.gg/KeDn2uXhER) (ask questions here!)
- [Issue Tracker](https://github.com/mochajs/mocha/issues)
@@ -59,7 +61,7 @@ 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%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
- Mocha could use a hand with [these issues](https://github.com/mochajs/mocha/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
-- The [maintainer's handbook](https://github.com/mochajs/mocha/blob/master/MAINTAINERS.md) explains how things get done
+- The [maintainer's handbook](https://github.com/mochajs/mocha/blob/main/MAINTAINERS.md) explains how things get done
Finally, come [chat with the maintainers on Discord](https://discord.gg/KeDn2uXhER) if you want to help with:
@@ -69,6 +71,4 @@ Finally, come [chat with the maintainers on Discord](https://discord.gg/KeDn2uXh
## License
-Copyright 2011-2022 OpenJS Foundation and contributors. Licensed [MIT](https://github.com/mochajs/mocha/blob/master/LICENSE).
-
-[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha?ref=badge_large)
+Copyright 2011-2024 OpenJS Foundation and contributors. Licensed [MIT](https://github.com/mochajs/mocha/blob/main/LICENSE).
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 0000000000..f9dc270129
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,7 @@
+# Security Policy
+
+## Security contact information
+
+To report a security vulnerability, please use the
+[Tidelift security contact](https://tidelift.com/security).
+Tidelift will coordinate the fix and disclosure.
diff --git a/browser-entry.js b/browser-entry.js
index 67517db357..4e6f9e939a 100644
--- a/browser-entry.js
+++ b/browser-entry.js
@@ -71,8 +71,8 @@ process.listenerCount = function (name) {
process.on = function (e, fn) {
if (e === 'uncaughtException') {
- global.onerror = function (err, url, line) {
- fn(new Error(err + ' (' + url + ':' + line + ')'));
+ global.onerror = function (msg, url, line, col, err) {
+ fn(err || new Error(msg + ' (' + url + ':' + line + ':' + col + ')'));
return !mocha.options.allowUncaught;
};
uncaughtExceptionHandlers.push(fn);
diff --git a/docs/API.md b/docs/API.md
index 7b63a6b433..a6e17bf284 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -13,7 +13,7 @@ Otherwise, **you probably want the [main documentation](https://mochajs.org)**.
## Other Links
- **[Main 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)
+- **[Release Notes / History / Changes](https://github.com/mochajs/mocha/blob/main/CHANGELOG.md)**
+- [Code of Conduct](https://github.com/mochajs/mocha/blob/main/.github/CODE_OF_CONDUCT.md)
- [Discord](https://discord.gg/KeDn2uXhER) (ask questions here!)
- [Issue Tracker](https://github.com/mochajs/mocha/issues)
diff --git a/docs/README.md b/docs/README.md
index f85b53adec..09f5e5857b 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -4,42 +4,14 @@ _So you wanna build the site?_
[mochajs.org](https://mochajs.org) is built using [Eleventy](https://www.11ty.io/), a simple static site generator.
-## Prerequisites
-
-- Node.js v10.12.0 or greater
-
## Development
-1. Run `npm install` from working copy root to get Node.js deps.
-1. To serve the site and rebuild as changes are made, execute `npm start docs.watch`.
-1. To rebuild the site _once_, execute `npm start docs`.
+1. Run `npm install` / `npm ci` from working copy root to get Node.js deps.
+1. To serve the site and rebuild as changes are made, execute `npm run docs-watch`.
+1. To rebuild the site _once_, execute `npm run docs`.
### Notes
- The content lives in `docs/index.md`; everything else is markup, scripts, assets, etc.
- This file (`docs/README.md`) should _not_ be included in the build.
-- `docs/_dist` is where the deployed site lives. `docs/_site` is essentially a build step. These directories are _not_ under version control.
-- If you get the error message below when running `npm start docs`, follow [this guide](https://www.npmjs.com/package/gm) to install GraphicsMagick or ImageMagick.
-
-```console
-โ WARN: docs/_site/images/matomo-logo.png: Error executing Stream: The gm stream ended without emitting any data
-(node:45255) UnhandledPromiseRejectionWarning: Error: docs/_site/images/matomo-logo.png: Error executing Stream: The gm stream ended without emitting any data
- at Socket.stdout.on.once (/Users/username/mocha/node_modules/express-processimage/lib/getFilterInfosAndTargetContentTypeFromQueryString.js:821:31)
- at Object.onceWrapper (events.js:286:20)
- at Socket.emit (events.js:203:15)
- at endReadableNT (_stream_readable.js:1145:12)
- at process._tickCallback (internal/process/next_tick.js:63:19)
-(node:45255) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
-(node:45255) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
-cp: docs/_dist/_headers: No such file or directory
-```
-
-- See `package-scripts.js` for details on what the builds are actually doing.
-
-## License
-
-:copyright: 2016-2018 [JS Foundation](https://js.foundation) and contributors.
-
-Content licensed [CC-BY-4.0](https://raw.githubusercontent.com/mochajs/mocha/master/docs/LICENSE-CC-BY-4.0).
-
-Code licensed [MIT](https://raw.githubusercontent.com/mochajs/mocha/master/LICENSE-MIT).
+- `docs/_site_` is where the deployed site lives. This directories are _not_ under version control.
diff --git a/docs/_data/supporters.js b/docs/_data/supporters.js
index d31bebd524..21d950d1d3 100755
--- a/docs/_data/supporters.js
+++ b/docs/_data/supporters.js
@@ -17,7 +17,6 @@
'use strict';
-const {loadImage} = require('canvas');
const {writeFile, mkdir, rm} = require('fs').promises;
const {resolve} = require('path');
const debug = require('debug')('mocha:docs:data:supporters');
@@ -28,7 +27,7 @@ const blocklist = new Set(require('./blocklist.json'));
* In addition to the blocklist, any account slug matching this regex will not
* be displayed on the website.
*/
-const BLOCKED_STRINGS = /(?:[ck]a[sz]ino|seo|slots|gambl(?:e|ing)|crypto)/i;
+const BLOCKED_STRINGS = /(?:[ck]a[sz]ino|seo|slot|gambl(?:e|ing)|crypto|follow|buy|cheap|instagram|hacks|tiktok|likes|youtube|subscriber|boost|deposit|mushroom|bingo|broker|promotion|bathroom|landscaping|lawn care|groundskeeping|remediation|esports|links|coupon|review|refer|promocode|rabattkod|jรคmfรถr|betting|reddit|hire|fortune|equity|download|marketing|comment|rank|scrapcar|lawyer|celeb|concrete|firestick|playground)/i;
/**
* Add a few Categories exposed by Open Collective to help moderation
@@ -39,7 +38,8 @@ const BLOCKED_CATEGORIES = [
'credit',
'gambling',
'seo',
- 'writer'
+ 'writer',
+ 'review'
];
/**
@@ -115,13 +115,6 @@ const fetchImage = process.env.MOCHA_DOCS_SKIP_IMAGE_DOWNLOAD
);
}
debug('fetched %s', url);
- const canvasImage = await loadImage(imageBuf);
- debug('ok %s', url);
- supporter.dimensions = {
- width: canvasImage.width,
- height: canvasImage.height
- };
- // debug('dimensions %s %dw %dh', url, canvasImage.width, canvasImage.height);
const filePath = resolve(SUPPORTER_IMAGE_PATH, supporter.id + '.png');
await writeFile(filePath, imageBuf);
debug('wrote %s', filePath);
@@ -168,10 +161,21 @@ const getAllOrders = async (slug = 'mochajs') => {
}
};
-const isAllowed = ({slug, categories}) =>
- !blocklist.has(slug) &&
- !BLOCKED_STRINGS.test(slug) &&
- !categories.some(category => BLOCKED_CATEGORIES.includes(category));
+const isAllowed = ({name, slug, website, categories}) => {
+ const allowed = !blocklist.has(slug) &&
+ !BLOCKED_STRINGS.test(name) &&
+ !BLOCKED_STRINGS.test(slug) &&
+ !BLOCKED_STRINGS.test(website) &&
+ !categories.some(category => BLOCKED_CATEGORIES.includes(category));
+
+ if (!allowed) {
+ debug('filtering %o', {categories, name, slug, website});
+ } else {
+ // debug('keeping %o', {categories, name, slug, website}, BLOCKED_STRINGS.test(website));
+ }
+
+ return allowed;
+};
const getSupporters = async () => {
const orders = await getAllOrders();
diff --git a/docs/_includes/supporters.md b/docs/_includes/supporters.md
index 96d13eb5d9..3ef3e050ba 100644
--- a/docs/_includes/supporters.md
+++ b/docs/_includes/supporters.md
@@ -2,13 +2,13 @@
Use Mocha at Work? Ask your manager or marketing team if they'd help [support](https://opencollective.com/mochajs#support) our project. Your company's logo will also be displayed on [npmjs.com](http://npmjs.com/package/mocha) and our [GitHub repository](https://github.com/mochajs/mocha#sponsors).
-