mocha 9.2.0 → 10.0.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,7 @@
1
1
  {
2
2
  "name": "mocha",
3
- "version": "9.2.0",
3
+ "version": "10.0.0",
4
+ "type": "commonjs",
4
5
  "description": "simple, flexible, fun test framework",
5
6
  "keywords": [
6
7
  "mocha",
@@ -17,10 +18,6 @@
17
18
  "jasmine",
18
19
  "karma"
19
20
  ],
20
- "funding": {
21
- "type": "opencollective",
22
- "url": "https://opencollective.com/mochajs"
23
- },
24
21
  "author": "TJ Holowaychuk <tj@vision-media.ca>",
25
22
  "license": "MIT",
26
23
  "repository": {
@@ -30,11 +27,16 @@
30
27
  "bugs": {
31
28
  "url": "https://github.com/mochajs/mocha/issues/"
32
29
  },
30
+ "funding": {
31
+ "type": "opencollective",
32
+ "url": "https://opencollective.com/mochajs"
33
+ },
34
+ "gitter": "https://gitter.im/mochajs/mocha",
33
35
  "homepage": "https://mochajs.org/",
34
36
  "logo": "https://cldup.com/S9uQ-cOLYz.svg",
35
37
  "notifyLogo": "https://ibin.co/4QuRuGjXvl36.png",
36
38
  "bin": {
37
- "mocha": "./bin/mocha",
39
+ "mocha": "./bin/mocha.js",
38
40
  "_mocha": "./bin/_mocha"
39
41
  },
40
42
  "directories": {
@@ -42,7 +44,7 @@
42
44
  "test": "./test"
43
45
  },
44
46
  "engines": {
45
- "node": ">= 12.0.0"
47
+ "node": ">= 14.0.0"
46
48
  },
47
49
  "scripts": {
48
50
  "prepublishOnly": "nps test clean build",
@@ -56,45 +58,40 @@
56
58
  "ansi-colors": "4.1.1",
57
59
  "browser-stdout": "1.3.1",
58
60
  "chokidar": "3.5.3",
59
- "debug": "4.3.3",
61
+ "debug": "4.3.4",
60
62
  "diff": "5.0.0",
61
63
  "escape-string-regexp": "4.0.0",
62
64
  "find-up": "5.0.0",
63
65
  "glob": "7.2.0",
64
- "growl": "1.10.5",
65
66
  "he": "1.2.0",
66
67
  "js-yaml": "4.1.0",
67
68
  "log-symbols": "4.1.0",
68
- "minimatch": "3.0.4",
69
+ "minimatch": "5.0.1",
69
70
  "ms": "2.1.3",
70
- "nanoid": "3.2.0",
71
+ "nanoid": "3.3.3",
71
72
  "serialize-javascript": "6.0.0",
72
73
  "strip-json-comments": "3.1.1",
73
74
  "supports-color": "8.1.1",
74
- "which": "2.0.2",
75
- "workerpool": "6.2.0",
75
+ "workerpool": "6.2.1",
76
76
  "yargs": "16.2.0",
77
77
  "yargs-parser": "20.2.4",
78
78
  "yargs-unparser": "2.0.0"
79
79
  },
80
80
  "devDependencies": {
81
- "@11ty/eleventy": "^0.12.1",
81
+ "@11ty/eleventy": "^1.0.0",
82
82
  "@11ty/eleventy-plugin-inclusive-language": "^1.0.3",
83
83
  "@babel/eslint-parser": "^7.16.5",
84
- "@babel/preset-env": "^7.16.11",
85
- "@mocha/docdash": "^4.0.0",
86
- "@rollup/plugin-babel": "^5.1.0",
87
- "@rollup/plugin-commonjs": "^14.0.0",
84
+ "@mocha/docdash": "^4.0.1",
85
+ "@rollup/plugin-commonjs": "^21.0.2",
88
86
  "@rollup/plugin-json": "^4.1.0",
89
- "@rollup/plugin-multi-entry": "^3.0.1",
90
- "@rollup/plugin-node-resolve": "^8.4.0",
87
+ "@rollup/plugin-multi-entry": "^4.0.1",
88
+ "@rollup/plugin-node-resolve": "^13.1.3",
91
89
  "assetgraph-builder": "^9.0.0",
92
90
  "autoprefixer": "^9.8.6",
93
91
  "canvas": "^2.9.0",
94
92
  "chai": "^4.3.4",
95
- "coffee-script": "^1.12.7",
93
+ "coffeescript": "^2.6.1",
96
94
  "configstore": "^5.0.1",
97
- "core-js": "^3.20.3",
98
95
  "coveralls": "^3.1.1",
99
96
  "cross-env": "^7.0.2",
100
97
  "eslint": "^7.32.0",
@@ -115,7 +112,6 @@
115
112
  "karma-chrome-launcher": "^3.1.0",
116
113
  "karma-mocha": "^2.0.1",
117
114
  "karma-mocha-reporter": "^2.2.5",
118
- "karma-requirejs": "^1.1.0",
119
115
  "karma-sauce-launcher": "^4.3.6",
120
116
  "lint-staged": "^10.2.11",
121
117
  "markdown-it": "^12.3.2",
@@ -130,17 +126,15 @@
130
126
  "nyc": "^15.1.0",
131
127
  "pidtree": "^0.5.0",
132
128
  "prettier": "^2.4.1",
133
- "regenerator-runtime": "0.13.7",
134
129
  "remark": "^14.0.2",
135
130
  "remark-github": "^11.2.2",
136
131
  "remark-inline-links": "^6.0.1",
137
- "requirejs": "^2.3.6",
138
132
  "rewiremock": "^3.14.3",
139
133
  "rimraf": "^3.0.2",
140
- "rollup": "^2.66.0",
134
+ "rollup": "^2.70.1",
141
135
  "rollup-plugin-node-globals": "^1.4.0",
142
- "rollup-plugin-node-polyfills": "^0.2.1",
143
- "rollup-plugin-visualizer": "^5.5.4",
136
+ "rollup-plugin-polyfill-node": "^0.8.0",
137
+ "rollup-plugin-visualizer": "^5.6.0",
144
138
  "sinon": "^9.0.3",
145
139
  "strip-ansi": "^6.0.0",
146
140
  "svgo": "^1.3.2",
@@ -159,19 +153,16 @@
159
153
  "webpack-cli": "^4.9.1"
160
154
  },
161
155
  "files": [
162
- "bin/*mocha",
163
- "assets/growl/*.png",
156
+ "bin/*mocha*",
164
157
  "lib/**/*.{js,html,json}",
165
158
  "index.js",
166
159
  "mocha.css",
167
160
  "mocha.js",
168
161
  "mocha.js.map",
169
- "mocha-es2018.js",
170
162
  "browser-entry.js"
171
163
  ],
172
164
  "browser": {
173
165
  "./index.js": "./browser-entry.js",
174
- "./lib/nodejs/growl.js": "./lib/browser/growl.js",
175
166
  "fs": false,
176
167
  "path": false,
177
168
  "supports-color": false,
@@ -191,7 +182,6 @@
191
182
  "singleQuote": true,
192
183
  "trailingComma": "none"
193
184
  },
194
- "gitter": "https://gitter.im/mochajs/mocha",
195
185
  "husky": {
196
186
  "hooks": {
197
187
  "pre-commit": "lint-staged"
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
- };