mocha 9.2.2 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mocha",
3
- "version": "9.2.2",
3
+ "version": "10.2.0",
4
4
  "type": "commonjs",
5
5
  "description": "simple, flexible, fun test framework",
6
6
  "keywords": [
@@ -36,7 +36,7 @@
36
36
  "logo": "https://cldup.com/S9uQ-cOLYz.svg",
37
37
  "notifyLogo": "https://ibin.co/4QuRuGjXvl36.png",
38
38
  "bin": {
39
- "mocha": "./bin/mocha",
39
+ "mocha": "./bin/mocha.js",
40
40
  "_mocha": "./bin/_mocha"
41
41
  },
42
42
  "directories": {
@@ -44,7 +44,7 @@
44
44
  "test": "./test"
45
45
  },
46
46
  "engines": {
47
- "node": ">= 12.0.0"
47
+ "node": ">= 14.0.0"
48
48
  },
49
49
  "scripts": {
50
50
  "prepublishOnly": "nps test clean build",
@@ -54,59 +54,52 @@
54
54
  "test:smoke": "node ./bin/mocha --no-config test/smoke/smoke.spec.js"
55
55
  },
56
56
  "dependencies": {
57
- "@ungap/promise-all-settled": "1.1.2",
58
57
  "ansi-colors": "4.1.1",
59
58
  "browser-stdout": "1.3.1",
60
59
  "chokidar": "3.5.3",
61
- "debug": "4.3.3",
60
+ "debug": "4.3.4",
62
61
  "diff": "5.0.0",
63
62
  "escape-string-regexp": "4.0.0",
64
63
  "find-up": "5.0.0",
65
64
  "glob": "7.2.0",
66
- "growl": "1.10.5",
67
65
  "he": "1.2.0",
68
66
  "js-yaml": "4.1.0",
69
67
  "log-symbols": "4.1.0",
70
- "minimatch": "4.2.1",
68
+ "minimatch": "5.0.1",
71
69
  "ms": "2.1.3",
72
- "nanoid": "3.3.1",
70
+ "nanoid": "3.3.3",
73
71
  "serialize-javascript": "6.0.0",
74
72
  "strip-json-comments": "3.1.1",
75
73
  "supports-color": "8.1.1",
76
- "which": "2.0.2",
77
- "workerpool": "6.2.0",
74
+ "workerpool": "6.2.1",
78
75
  "yargs": "16.2.0",
79
76
  "yargs-parser": "20.2.4",
80
77
  "yargs-unparser": "2.0.0"
81
78
  },
82
79
  "devDependencies": {
83
- "@11ty/eleventy": "^0.12.1",
80
+ "@11ty/eleventy": "^1.0.0",
84
81
  "@11ty/eleventy-plugin-inclusive-language": "^1.0.3",
85
- "@babel/eslint-parser": "^7.16.5",
86
- "@babel/preset-env": "^7.16.11",
87
- "@mocha/docdash": "^4.0.0",
88
- "@rollup/plugin-babel": "^5.1.0",
89
- "@rollup/plugin-commonjs": "^14.0.0",
82
+ "@babel/eslint-parser": "^7.19.1",
83
+ "@mocha/docdash": "^4.0.1",
84
+ "@rollup/plugin-commonjs": "^21.0.2",
90
85
  "@rollup/plugin-json": "^4.1.0",
91
- "@rollup/plugin-multi-entry": "^3.0.1",
92
- "@rollup/plugin-node-resolve": "^8.4.0",
86
+ "@rollup/plugin-multi-entry": "^4.0.1",
87
+ "@rollup/plugin-node-resolve": "^13.1.3",
93
88
  "assetgraph-builder": "^9.0.0",
94
89
  "autoprefixer": "^9.8.6",
95
90
  "canvas": "^2.9.0",
96
91
  "chai": "^4.3.4",
97
- "coffee-script": "^1.12.7",
98
- "configstore": "^5.0.1",
99
- "core-js": "^3.20.3",
92
+ "coffeescript": "^2.6.1",
100
93
  "coveralls": "^3.1.1",
101
94
  "cross-env": "^7.0.2",
102
- "eslint": "^7.32.0",
95
+ "eslint": "^8.24.0",
103
96
  "eslint-config-prettier": "^8.3.0",
104
- "eslint-config-semistandard": "^16.0.0",
105
- "eslint-config-standard": "^16.0.3",
97
+ "eslint-config-semistandard": "^17.0.0",
98
+ "eslint-config-standard": "^17.0.0",
106
99
  "eslint-plugin-import": "^2.24.2",
107
100
  "eslint-plugin-node": "^11.1.0",
108
- "eslint-plugin-prettier": "^4.0.0",
109
- "eslint-plugin-promise": "^5.1.0",
101
+ "eslint-plugin-prettier": "^4.2.1",
102
+ "eslint-plugin-promise": "^6.0.1",
110
103
  "fail-on-errors-webpack-plugin": "^3.0.0",
111
104
  "fs-extra": "^10.0.0",
112
105
  "husky": "^4.2.5",
@@ -117,7 +110,6 @@
117
110
  "karma-chrome-launcher": "^3.1.0",
118
111
  "karma-mocha": "^2.0.1",
119
112
  "karma-mocha-reporter": "^2.2.5",
120
- "karma-requirejs": "^1.1.0",
121
113
  "karma-sauce-launcher": "^4.3.6",
122
114
  "lint-staged": "^10.2.11",
123
115
  "markdown-it": "^12.3.2",
@@ -132,21 +124,18 @@
132
124
  "nyc": "^15.1.0",
133
125
  "pidtree": "^0.5.0",
134
126
  "prettier": "^2.4.1",
135
- "regenerator-runtime": "0.13.7",
136
127
  "remark": "^14.0.2",
137
128
  "remark-github": "^11.2.2",
138
129
  "remark-inline-links": "^6.0.1",
139
- "requirejs": "^2.3.6",
140
130
  "rewiremock": "^3.14.3",
141
131
  "rimraf": "^3.0.2",
142
- "rollup": "^2.66.0",
132
+ "rollup": "^2.70.1",
143
133
  "rollup-plugin-node-globals": "^1.4.0",
144
- "rollup-plugin-node-polyfills": "^0.2.1",
145
- "rollup-plugin-visualizer": "^5.5.4",
134
+ "rollup-plugin-polyfill-node": "^0.8.0",
135
+ "rollup-plugin-visualizer": "^5.6.0",
146
136
  "sinon": "^9.0.3",
147
137
  "strip-ansi": "^6.0.0",
148
138
  "svgo": "^1.3.2",
149
- "through2": "^4.0.2",
150
139
  "touch": "^3.1.0",
151
140
  "unexpected": "^11.14.0",
152
141
  "unexpected-eventemitter": "^2.2.0",
@@ -156,24 +145,20 @@
156
145
  "update-notifier": "^4.1.0",
157
146
  "uslug": "^1.0.4",
158
147
  "uuid": "^8.3.0",
159
- "watchify": "^4.0.0",
160
148
  "webpack": "^5.67.0",
161
149
  "webpack-cli": "^4.9.1"
162
150
  },
163
151
  "files": [
164
- "bin/*mocha",
165
- "assets/growl/*.png",
152
+ "bin/*mocha*",
166
153
  "lib/**/*.{js,html,json}",
167
154
  "index.js",
168
155
  "mocha.css",
169
156
  "mocha.js",
170
157
  "mocha.js.map",
171
- "mocha-es2018.js",
172
158
  "browser-entry.js"
173
159
  ],
174
160
  "browser": {
175
161
  "./index.js": "./browser-entry.js",
176
- "./lib/nodejs/growl.js": "./lib/browser/growl.js",
177
162
  "fs": false,
178
163
  "path": false,
179
164
  "supports-color": false,
Binary file
Binary file
@@ -1,169 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Web Notifications module.
5
- * @module Growl
6
- */
7
-
8
- /**
9
- * Save timer references to avoid Sinon interfering (see GH-237).
10
- */
11
- var Date = global.Date;
12
- var setTimeout = global.setTimeout;
13
- var EVENT_RUN_END = require('../runner').constants.EVENT_RUN_END;
14
- var isBrowser = require('../utils').isBrowser;
15
-
16
- /**
17
- * Checks if browser notification support exists.
18
- *
19
- * @public
20
- * @see {@link https://caniuse.com/#feat=notifications|Browser support (notifications)}
21
- * @see {@link https://caniuse.com/#feat=promises|Browser support (promises)}
22
- * @see {@link Mocha#growl}
23
- * @see {@link Mocha#isGrowlCapable}
24
- * @return {boolean} whether browser notification support exists
25
- */
26
- exports.isCapable = function () {
27
- var hasNotificationSupport = 'Notification' in window;
28
- var hasPromiseSupport = typeof Promise === 'function';
29
- return isBrowser() && hasNotificationSupport && hasPromiseSupport;
30
- };
31
-
32
- /**
33
- * Implements browser notifications as a pseudo-reporter.
34
- *
35
- * @public
36
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/notification|Notification API}
37
- * @see {@link https://developers.google.com/web/fundamentals/push-notifications/display-a-notification|Displaying a Notification}
38
- * @see {@link Growl#isPermitted}
39
- * @see {@link Mocha#_growl}
40
- * @param {Runner} runner - Runner instance.
41
- */
42
- exports.notify = function (runner) {
43
- var promise = isPermitted();
44
-
45
- /**
46
- * Attempt notification.
47
- */
48
- var sendNotification = function () {
49
- // If user hasn't responded yet... "No notification for you!" (Seinfeld)
50
- Promise.race([promise, Promise.resolve(undefined)])
51
- .then(canNotify)
52
- .then(function () {
53
- display(runner);
54
- })
55
- .catch(notPermitted);
56
- };
57
-
58
- runner.once(EVENT_RUN_END, sendNotification);
59
- };
60
-
61
- /**
62
- * Checks if browser notification is permitted by user.
63
- *
64
- * @private
65
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Notification/permission|Notification.permission}
66
- * @see {@link Mocha#growl}
67
- * @see {@link Mocha#isGrowlPermitted}
68
- * @returns {Promise<boolean>} promise determining if browser notification
69
- * permissible when fulfilled.
70
- */
71
- function isPermitted() {
72
- var permitted = {
73
- granted: function allow() {
74
- return Promise.resolve(true);
75
- },
76
- denied: function deny() {
77
- return Promise.resolve(false);
78
- },
79
- default: function ask() {
80
- return Notification.requestPermission().then(function (permission) {
81
- return permission === 'granted';
82
- });
83
- }
84
- };
85
-
86
- return permitted[Notification.permission]();
87
- }
88
-
89
- /**
90
- * @summary
91
- * Determines if notification should proceed.
92
- *
93
- * @description
94
- * Notification shall <strong>not</strong> proceed unless `value` is true.
95
- *
96
- * `value` will equal one of:
97
- * <ul>
98
- * <li><code>true</code> (from `isPermitted`)</li>
99
- * <li><code>false</code> (from `isPermitted`)</li>
100
- * <li><code>undefined</code> (from `Promise.race`)</li>
101
- * </ul>
102
- *
103
- * @private
104
- * @param {boolean|undefined} value - Determines if notification permissible.
105
- * @returns {Promise<undefined>} Notification can proceed
106
- */
107
- function canNotify(value) {
108
- if (!value) {
109
- var why = value === false ? 'blocked' : 'unacknowledged';
110
- var reason = 'not permitted by user (' + why + ')';
111
- return Promise.reject(new Error(reason));
112
- }
113
- return Promise.resolve();
114
- }
115
-
116
- /**
117
- * Displays the notification.
118
- *
119
- * @private
120
- * @param {Runner} runner - Runner instance.
121
- */
122
- function display(runner) {
123
- var stats = runner.stats;
124
- var symbol = {
125
- cross: '\u274C',
126
- tick: '\u2705'
127
- };
128
- var logo = require('../../package.json').notifyLogo;
129
- var _message;
130
- var message;
131
- var title;
132
-
133
- if (stats.failures) {
134
- _message = stats.failures + ' of ' + stats.tests + ' tests failed';
135
- message = symbol.cross + ' ' + _message;
136
- title = 'Failed';
137
- } else {
138
- _message = stats.passes + ' tests passed in ' + stats.duration + 'ms';
139
- message = symbol.tick + ' ' + _message;
140
- title = 'Passed';
141
- }
142
-
143
- // Send notification
144
- var options = {
145
- badge: logo,
146
- body: message,
147
- dir: 'ltr',
148
- icon: logo,
149
- lang: 'en-US',
150
- name: 'mocha',
151
- requireInteraction: false,
152
- timestamp: Date.now()
153
- };
154
- var notification = new Notification(title, options);
155
-
156
- // Autoclose after brief delay (makes various browsers act same)
157
- var FORCE_DURATION = 4000;
158
- setTimeout(notification.close.bind(notification), FORCE_DURATION);
159
- }
160
-
161
- /**
162
- * As notifications are tangential to our purpose, just log the error.
163
- *
164
- * @private
165
- * @param {Error} err - Why notification didn't happen.
166
- */
167
- function notPermitted(err) {
168
- console.error('notification error:', err.message);
169
- }
@@ -1,137 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Desktop Notifications module.
5
- * @module Growl
6
- */
7
-
8
- const os = require('os');
9
- const path = require('path');
10
- const {sync: which} = require('which');
11
- const {EVENT_RUN_END} = require('../runner').constants;
12
- const {isBrowser} = require('../utils');
13
-
14
- /**
15
- * @summary
16
- * Checks if Growl notification support seems likely.
17
- *
18
- * @description
19
- * Glosses over the distinction between an unsupported platform
20
- * and one that lacks prerequisite software installations.
21
- *
22
- * @public
23
- * @see {@link https://github.com/tj/node-growl/blob/master/README.md|Prerequisite Installs}
24
- * @see {@link Mocha#growl}
25
- * @see {@link Mocha#isGrowlCapable}
26
- * @return {boolean} whether Growl notification support can be expected
27
- */
28
- exports.isCapable = () => {
29
- if (!isBrowser()) {
30
- return getSupportBinaries().reduce(
31
- (acc, binary) => acc || Boolean(which(binary, {nothrow: true})),
32
- false
33
- );
34
- }
35
- return false;
36
- };
37
-
38
- /**
39
- * Implements desktop notifications as a pseudo-reporter.
40
- *
41
- * @public
42
- * @see {@link Mocha#_growl}
43
- * @param {Runner} runner - Runner instance.
44
- */
45
- exports.notify = runner => {
46
- runner.once(EVENT_RUN_END, () => {
47
- display(runner);
48
- });
49
- };
50
-
51
- /**
52
- * Displays the notification.
53
- *
54
- * @private
55
- * @param {Runner} runner - Runner instance.
56
- */
57
- const display = runner => {
58
- const growl = require('growl');
59
- const stats = runner.stats;
60
- const symbol = {
61
- cross: '\u274C',
62
- tick: '\u2705'
63
- };
64
- let _message;
65
- let message;
66
- let title;
67
-
68
- if (stats.failures) {
69
- _message = `${stats.failures} of ${stats.tests} tests failed`;
70
- message = `${symbol.cross} ${_message}`;
71
- title = 'Failed';
72
- } else {
73
- _message = `${stats.passes} tests passed in ${stats.duration}ms`;
74
- message = `${symbol.tick} ${_message}`;
75
- title = 'Passed';
76
- }
77
-
78
- // Send notification
79
- const options = {
80
- image: logo(),
81
- name: 'mocha',
82
- title
83
- };
84
- growl(message, options, onCompletion);
85
- };
86
-
87
- /**
88
- * @summary
89
- * Callback for result of attempted Growl notification.
90
- *
91
- * @description
92
- * Despite its appearance, this is <strong>not</strong> an Error-first
93
- * callback -- all parameters are populated regardless of success.
94
- *
95
- * @private
96
- * @callback Growl~growlCB
97
- * @param {*} err - Error object, or <code>null</code> if successful.
98
- */
99
- function onCompletion(err) {
100
- if (err) {
101
- // As notifications are tangential to our purpose, just log the error.
102
- const message =
103
- err.code === 'ENOENT' ? 'prerequisite software not found' : err.message;
104
- console.error('notification error:', message);
105
- }
106
- }
107
-
108
- /**
109
- * Returns Mocha logo image path.
110
- *
111
- * @private
112
- * @return {string} Pathname of Mocha logo
113
- */
114
- const logo = () => {
115
- return path.join(__dirname, '..', 'assets', 'mocha-logo-96.png');
116
- };
117
-
118
- /**
119
- * @summary
120
- * Gets platform-specific Growl support binaries.
121
- *
122
- * @description
123
- * Somewhat brittle dependency on `growl` package implementation, but it
124
- * rarely changes.
125
- *
126
- * @private
127
- * @see {@link https://github.com/tj/node-growl/blob/master/lib/growl.js#L28-L126|setupCmd}
128
- * @return {string[]} names of Growl support binaries
129
- */
130
- const getSupportBinaries = () => {
131
- const binaries = {
132
- Darwin: ['terminal-notifier', 'growlnotify'],
133
- Linux: ['notify-send', 'growl'],
134
- Windows_NT: ['growlnotify.exe']
135
- };
136
- return binaries[os.type()] || [];
137
- };