@eggjs/mock 6.1.0-beta.10 → 6.1.0-beta.11

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.
Files changed (102) hide show
  1. package/README.md +1 -1
  2. package/README.zh_CN.md +1 -1
  3. package/dist/_virtual/rolldown_runtime.js +1 -24
  4. package/dist/inject_mocha.d.ts +1 -1
  5. package/dist/inject_mocha.js +2 -3
  6. package/dist/lib/context.js +1 -3
  7. package/package.json +6 -8
  8. package/dist/node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js +0 -142
  9. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js +0 -157
  10. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js +0 -97
  11. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js +0 -40
  12. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js +0 -814
  13. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js +0 -50
  14. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js +0 -68
  15. package/dist/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js +0 -752
  16. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js +0 -203
  17. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js +0 -209
  18. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js +0 -18
  19. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js +0 -215
  20. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/dmp.js +0 -24
  21. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/xml.js +0 -33
  22. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/array.js +0 -29
  23. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/base.js +0 -185
  24. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/character.js +0 -23
  25. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/css.js +0 -26
  26. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/json.js +0 -83
  27. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/line.js +0 -51
  28. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/sentence.js +0 -26
  29. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/word.js +0 -151
  30. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.js +0 -178
  31. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/apply.js +0 -168
  32. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/create.js +0 -301
  33. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/line-endings.js +0 -137
  34. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/merge.js +0 -367
  35. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/parse.js +0 -91
  36. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/reverse.js +0 -99
  37. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/array.js +0 -23
  38. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/distance-iterator.js +0 -30
  39. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/params.js +0 -22
  40. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/string.js +0 -97
  41. package/dist/node_modules/.pnpm/escape-string-regexp@4.0.0/node_modules/escape-string-regexp/index.js +0 -14
  42. package/dist/node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js +0 -16
  43. package/dist/node_modules/.pnpm/he@1.2.0/node_modules/he/he.js +0 -4093
  44. package/dist/node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js +0 -14
  45. package/dist/node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js +0 -27
  46. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/index.js +0 -12
  47. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/context.js +0 -83
  48. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/error-constants.js +0 -35
  49. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/errors.js +0 -392
  50. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/hook.js +0 -86
  51. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/bdd.js +0 -104
  52. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/common.js +0 -99
  53. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/exports.js +0 -65
  54. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/index.js +0 -18
  55. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/qunit.js +0 -95
  56. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/tdd.js +0 -105
  57. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocha.js +0 -1037
  58. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocharc.js +0 -24
  59. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/buffered-worker-pool.js +0 -152
  60. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/esm-utils.js +0 -74
  61. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/file-unloader.js +0 -22
  62. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/parallel-buffered-runner.js +0 -329
  63. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/serializer.js +0 -314
  64. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/pending.js +0 -22
  65. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/base.js +0 -417
  66. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/doc.js +0 -79
  67. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/dot.js +0 -75
  68. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/html.js +0 -283
  69. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/index.js +0 -40
  70. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json-stream.js +0 -90
  71. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json.js +0 -145
  72. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/landing.js +0 -107
  73. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/list.js +0 -77
  74. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/markdown.js +0 -106
  75. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/min.js +0 -57
  76. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/nyan.js +0 -233
  77. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/progress.js +0 -92
  78. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/spec.js +0 -91
  79. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/tap.js +0 -261
  80. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/xunit.js +0 -166
  81. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runnable.js +0 -346
  82. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runner.js +0 -922
  83. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/stats-collector.js +0 -72
  84. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/suite.js +0 -517
  85. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/test.js +0 -105
  86. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/utils.js +0 -505
  87. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/package.js +0 -225
  88. package/dist/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js +0 -124
  89. package/dist/node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/index.js +0 -11
  90. package/dist/node_modules/.pnpm/serialize-javascript@6.0.2/node_modules/serialize-javascript/index.js +0 -114
  91. package/dist/node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js +0 -76
  92. package/dist/node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js +0 -89
  93. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Pool.js +0 -366
  94. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Promise.js +0 -248
  95. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/WorkerHandler.js +0 -419
  96. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/debug-port-allocator.js +0 -27
  97. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/environment.js +0 -18
  98. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/generated/embeddedWorker.js +0 -16
  99. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/index.js +0 -63
  100. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/transfer.js +0 -21
  101. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/validateOptions.js +0 -9
  102. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/worker.js +0 -277
@@ -1,14 +0,0 @@
1
- import { __commonJS } from "../../../../../_virtual/rolldown_runtime.js";
2
-
3
- //#region ../../node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js
4
- var require_is_unicode_supported = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js": ((exports, module) => {
5
- module.exports = () => {
6
- if (process.platform !== "win32") return true;
7
- return Boolean(process.env.CI) || Boolean(process.env.WT_SESSION) || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty";
8
- };
9
- }) });
10
-
11
- //#endregion
12
- export default require_is_unicode_supported();
13
-
14
- export { require_is_unicode_supported };
@@ -1,27 +0,0 @@
1
- import { __commonJS } from "../../../../../_virtual/rolldown_runtime.js";
2
- import { require_source } from "../../../chalk@4.1.2/node_modules/chalk/source/index.js";
3
- import { require_is_unicode_supported } from "../../../is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js";
4
-
5
- //#region ../../node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js
6
- var require_log_symbols = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js": ((exports, module) => {
7
- const chalk = require_source();
8
- const isUnicodeSupported = require_is_unicode_supported();
9
- const main = {
10
- info: chalk.blue("ℹ"),
11
- success: chalk.green("✔"),
12
- warning: chalk.yellow("⚠"),
13
- error: chalk.red("✖")
14
- };
15
- const fallback = {
16
- info: chalk.blue("i"),
17
- success: chalk.green("√"),
18
- warning: chalk.yellow("‼"),
19
- error: chalk.red("×")
20
- };
21
- module.exports = isUnicodeSupported() ? main : fallback;
22
- }) });
23
-
24
- //#endregion
25
- export default require_log_symbols();
26
-
27
- export { require_log_symbols };
@@ -1,12 +0,0 @@
1
- import { __commonJS } from "../../../../../_virtual/rolldown_runtime.js";
2
- import { require_mocha as require_mocha$1 } from "./lib/mocha.js";
3
-
4
- //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/index.js
5
- var require_mocha = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/index.js": ((exports, module) => {
6
- module.exports = require_mocha$1();
7
- }) });
8
-
9
- //#endregion
10
- export default require_mocha();
11
-
12
- export { require_mocha };
@@ -1,83 +0,0 @@
1
- import { __commonJS } from "../../../../../../_virtual/rolldown_runtime.js";
2
-
3
- //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/context.js
4
- var require_context = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/context.js": ((exports, module) => {
5
- /**
6
- * @typedef {import('./runnable.js')} Runnable
7
- */
8
- /**
9
- * @module Context
10
- */
11
- /**
12
- * Expose `Context`.
13
- */
14
- module.exports = Context;
15
- /**
16
- * Initialize a new `Context`.
17
- *
18
- * @private
19
- */
20
- function Context() {}
21
- /**
22
- * Set or get the context `Runnable` to `runnable`.
23
- *
24
- * @private
25
- * @param {Runnable} runnable
26
- * @return {Context} context
27
- */
28
- Context.prototype.runnable = function(runnable) {
29
- if (!arguments.length) return this._runnable;
30
- this.test = this._runnable = runnable;
31
- return this;
32
- };
33
- /**
34
- * Set or get test timeout `ms`.
35
- *
36
- * @private
37
- * @param {number} ms
38
- * @return {Context} self
39
- */
40
- Context.prototype.timeout = function(ms) {
41
- if (!arguments.length) return this.runnable().timeout();
42
- this.runnable().timeout(ms);
43
- return this;
44
- };
45
- /**
46
- * Set or get test slowness threshold `ms`.
47
- *
48
- * @private
49
- * @param {number} ms
50
- * @return {Context} self
51
- */
52
- Context.prototype.slow = function(ms) {
53
- if (!arguments.length) return this.runnable().slow();
54
- this.runnable().slow(ms);
55
- return this;
56
- };
57
- /**
58
- * Mark a test as skipped.
59
- *
60
- * @private
61
- * @throws Pending
62
- */
63
- Context.prototype.skip = function() {
64
- this.runnable().skip();
65
- };
66
- /**
67
- * Set or get a number of allowed retries on failed tests
68
- *
69
- * @private
70
- * @param {number} n
71
- * @return {Context} self
72
- */
73
- Context.prototype.retries = function(n) {
74
- if (!arguments.length) return this.runnable().retries();
75
- this.runnable().retries(n);
76
- return this;
77
- };
78
- }) });
79
-
80
- //#endregion
81
- export default require_context();
82
-
83
- export { require_context };
@@ -1,35 +0,0 @@
1
- import { __commonJS } from "../../../../../../_virtual/rolldown_runtime.js";
2
-
3
- //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/error-constants.js
4
- var require_error_constants = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/error-constants.js": ((exports, module) => {
5
- /**
6
- * When Mocha throws exceptions (or rejects `Promise`s), it attempts to assign a `code` property to the `Error` object, for easier handling. These are the potential values of `code`.
7
- * @public
8
- * @namespace
9
- * @memberof module:lib/errors
10
- */
11
- var constants = {
12
- FATAL: "ERR_MOCHA_FATAL",
13
- INVALID_ARG_TYPE: "ERR_MOCHA_INVALID_ARG_TYPE",
14
- INVALID_ARG_VALUE: "ERR_MOCHA_INVALID_ARG_VALUE",
15
- INVALID_EXCEPTION: "ERR_MOCHA_INVALID_EXCEPTION",
16
- INVALID_INTERFACE: "ERR_MOCHA_INVALID_INTERFACE",
17
- INVALID_REPORTER: "ERR_MOCHA_INVALID_REPORTER",
18
- MULTIPLE_DONE: "ERR_MOCHA_MULTIPLE_DONE",
19
- NO_FILES_MATCH_PATTERN: "ERR_MOCHA_NO_FILES_MATCH_PATTERN",
20
- UNSUPPORTED: "ERR_MOCHA_UNSUPPORTED",
21
- INSTANCE_ALREADY_RUNNING: "ERR_MOCHA_INSTANCE_ALREADY_RUNNING",
22
- INSTANCE_ALREADY_DISPOSED: "ERR_MOCHA_INSTANCE_ALREADY_DISPOSED",
23
- FORBIDDEN_EXCLUSIVITY: "ERR_MOCHA_FORBIDDEN_EXCLUSIVITY",
24
- INVALID_PLUGIN_IMPLEMENTATION: "ERR_MOCHA_INVALID_PLUGIN_IMPLEMENTATION",
25
- INVALID_PLUGIN_DEFINITION: "ERR_MOCHA_INVALID_PLUGIN_DEFINITION",
26
- TIMEOUT: "ERR_MOCHA_TIMEOUT",
27
- UNPARSABLE_FILE: "ERR_MOCHA_UNPARSABLE_FILE"
28
- };
29
- module.exports = { constants };
30
- }) });
31
-
32
- //#endregion
33
- export default require_error_constants();
34
-
35
- export { require_error_constants };
@@ -1,392 +0,0 @@
1
- import { __commonJS, __require } from "../../../../../../_virtual/rolldown_runtime.js";
2
- import { require_error_constants } from "./error-constants.js";
3
-
4
- //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/errors.js
5
- var require_errors = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/errors.js": ((exports, module) => {
6
- /**
7
- * @typedef {import('./mocha.js')} Mocha
8
- * @typedef {import('./runnable.js')} Runnable
9
- * @typedef {import('./types.d.ts').MochaTimeoutError} MochaTimeoutError
10
- * @typedef {import('./types.d.ts').PluginDefinition} PluginDefinition
11
- */
12
- const { format } = __require("node:util");
13
- const { constants } = require_error_constants();
14
- /**
15
- * Contains error codes, factory functions to create throwable error objects,
16
- * and warning/deprecation functions.
17
- * @module
18
- */
19
- /**
20
- * process.emitWarning or a polyfill
21
- * @see https://nodejs.org/api/process.html#process_process_emitwarning_warning_options
22
- * @ignore
23
- */
24
- const emitWarning = (msg, type) => {
25
- if (process.emitWarning) process.emitWarning(msg, type);
26
- else
27
- /* istanbul ignore next */
28
- process.nextTick(function() {
29
- console.warn(type + ": " + msg);
30
- });
31
- };
32
- /**
33
- * Show a deprecation warning. Each distinct message is only displayed once.
34
- * Ignores empty messages.
35
- *
36
- * @param {string} [msg] - Warning to print
37
- * @private
38
- */
39
- const deprecate = (msg) => {
40
- msg = String(msg);
41
- if (msg && !deprecate.cache[msg]) {
42
- deprecate.cache[msg] = true;
43
- emitWarning(msg, "DeprecationWarning");
44
- }
45
- };
46
- deprecate.cache = {};
47
- /**
48
- * Show a generic warning.
49
- * Ignores empty messages.
50
- *
51
- * @param {string} [msg] - Warning to print
52
- * @private
53
- */
54
- const warn = (msg) => {
55
- if (msg) emitWarning(msg);
56
- };
57
- /**
58
- * A set containing all string values of all Mocha error constants, for use by {@link isMochaError}.
59
- * @private
60
- */
61
- const MOCHA_ERRORS = new Set(Object.values(constants));
62
- /**
63
- * Creates an error object to be thrown when no files to be tested could be found using specified pattern.
64
- *
65
- * @public
66
- * @static
67
- * @param {string} message - Error message to be displayed.
68
- * @param {string} pattern - User-specified argument value.
69
- * @returns {Error} instance detailing the error condition
70
- */
71
- function createNoFilesMatchPatternError(message, pattern) {
72
- var err = new Error(message);
73
- err.code = constants.NO_FILES_MATCH_PATTERN;
74
- err.pattern = pattern;
75
- return err;
76
- }
77
- /**
78
- * Creates an error object to be thrown when the reporter specified in the options was not found.
79
- *
80
- * @public
81
- * @param {string} message - Error message to be displayed.
82
- * @param {string} reporter - User-specified reporter value.
83
- * @returns {Error} instance detailing the error condition
84
- */
85
- function createInvalidReporterError(message, reporter) {
86
- var err = new TypeError(message);
87
- err.code = constants.INVALID_REPORTER;
88
- err.reporter = reporter;
89
- return err;
90
- }
91
- /**
92
- * Creates an error object to be thrown when the interface specified in the options was not found.
93
- *
94
- * @public
95
- * @static
96
- * @param {string} message - Error message to be displayed.
97
- * @param {string} ui - User-specified interface value.
98
- * @returns {Error} instance detailing the error condition
99
- */
100
- function createInvalidInterfaceError(message, ui) {
101
- var err = new Error(message);
102
- err.code = constants.INVALID_INTERFACE;
103
- err.interface = ui;
104
- return err;
105
- }
106
- /**
107
- * Creates an error object to be thrown when a behavior, option, or parameter is unsupported.
108
- *
109
- * @public
110
- * @static
111
- * @param {string} message - Error message to be displayed.
112
- * @returns {Error} instance detailing the error condition
113
- */
114
- function createUnsupportedError(message) {
115
- var err = new Error(message);
116
- err.code = constants.UNSUPPORTED;
117
- return err;
118
- }
119
- /**
120
- * Creates an error object to be thrown when an argument is missing.
121
- *
122
- * @public
123
- * @static
124
- * @param {string} message - Error message to be displayed.
125
- * @param {string} argument - Argument name.
126
- * @param {string} expected - Expected argument datatype.
127
- * @returns {Error} instance detailing the error condition
128
- */
129
- function createMissingArgumentError(message, argument, expected) {
130
- return createInvalidArgumentTypeError(message, argument, expected);
131
- }
132
- /**
133
- * Creates an error object to be thrown when an argument did not use the supported type
134
- *
135
- * @public
136
- * @static
137
- * @param {string} message - Error message to be displayed.
138
- * @param {string} argument - Argument name.
139
- * @param {string} expected - Expected argument datatype.
140
- * @returns {Error} instance detailing the error condition
141
- */
142
- function createInvalidArgumentTypeError(message, argument, expected) {
143
- var err = new TypeError(message);
144
- err.code = constants.INVALID_ARG_TYPE;
145
- err.argument = argument;
146
- err.expected = expected;
147
- err.actual = typeof argument;
148
- return err;
149
- }
150
- /**
151
- * Creates an error object to be thrown when an argument did not use the supported value
152
- *
153
- * @public
154
- * @static
155
- * @param {string} message - Error message to be displayed.
156
- * @param {string} argument - Argument name.
157
- * @param {string} value - Argument value.
158
- * @param {string} [reason] - Why value is invalid.
159
- * @returns {Error} instance detailing the error condition
160
- */
161
- function createInvalidArgumentValueError(message, argument, value, reason) {
162
- var err = new TypeError(message);
163
- err.code = constants.INVALID_ARG_VALUE;
164
- err.argument = argument;
165
- err.value = value;
166
- err.reason = typeof reason !== "undefined" ? reason : "is invalid";
167
- return err;
168
- }
169
- /**
170
- * Creates an error object to be thrown when an exception was caught, but the `Error` is falsy or undefined.
171
- *
172
- * @public
173
- * @static
174
- * @param {string} message - Error message to be displayed.
175
- * @returns {Error} instance detailing the error condition
176
- */
177
- function createInvalidExceptionError(message, value) {
178
- var err = new Error(message);
179
- err.code = constants.INVALID_EXCEPTION;
180
- err.valueType = typeof value;
181
- err.value = value;
182
- return err;
183
- }
184
- /**
185
- * Creates an error object to be thrown when an unrecoverable error occurs.
186
- *
187
- * @public
188
- * @static
189
- * @param {string} message - Error message to be displayed.
190
- * @returns {Error} instance detailing the error condition
191
- */
192
- function createFatalError(message, value) {
193
- var err = new Error(message);
194
- err.code = constants.FATAL;
195
- err.valueType = typeof value;
196
- err.value = value;
197
- return err;
198
- }
199
- /**
200
- * Dynamically creates a plugin-type-specific error based on plugin type
201
- * @param {string} message - Error message
202
- * @param {"reporter"|"ui"} pluginType - Plugin type. Future: expand as needed
203
- * @param {string} [pluginId] - Name/path of plugin, if any
204
- * @throws When `pluginType` is not known
205
- * @public
206
- * @static
207
- * @returns {Error}
208
- */
209
- function createInvalidLegacyPluginError(message, pluginType, pluginId) {
210
- switch (pluginType) {
211
- case "reporter": return createInvalidReporterError(message, pluginId);
212
- case "ui": return createInvalidInterfaceError(message, pluginId);
213
- default: throw new Error("unknown pluginType \"" + pluginType + "\"");
214
- }
215
- }
216
- /**
217
- * **DEPRECATED**. Use {@link createInvalidLegacyPluginError} instead Dynamically creates a plugin-type-specific error based on plugin type
218
- * @deprecated
219
- * @param {string} message - Error message
220
- * @param {"reporter"|"interface"} pluginType - Plugin type. Future: expand as needed
221
- * @param {string} [pluginId] - Name/path of plugin, if any
222
- * @throws When `pluginType` is not known
223
- * @public
224
- * @static
225
- * @returns {Error}
226
- */
227
- function createInvalidPluginError(...args) {
228
- deprecate("Use createInvalidLegacyPluginError() instead");
229
- return createInvalidLegacyPluginError(...args);
230
- }
231
- /**
232
- * Creates an error object to be thrown when a mocha object's `run` method is executed while it is already disposed.
233
- * @param {string} message The error message to be displayed.
234
- * @param {boolean} cleanReferencesAfterRun the value of `cleanReferencesAfterRun`
235
- * @param {Mocha} instance the mocha instance that throw this error
236
- * @static
237
- */
238
- function createMochaInstanceAlreadyDisposedError(message, cleanReferencesAfterRun, instance) {
239
- var err = new Error(message);
240
- err.code = constants.INSTANCE_ALREADY_DISPOSED;
241
- err.cleanReferencesAfterRun = cleanReferencesAfterRun;
242
- err.instance = instance;
243
- return err;
244
- }
245
- /**
246
- * Creates an error object to be thrown when a mocha object's `run` method is called while a test run is in progress.
247
- * @param {string} message The error message to be displayed.
248
- * @static
249
- * @public
250
- */
251
- function createMochaInstanceAlreadyRunningError(message, instance) {
252
- var err = new Error(message);
253
- err.code = constants.INSTANCE_ALREADY_RUNNING;
254
- err.instance = instance;
255
- return err;
256
- }
257
- /**
258
- * Creates an error object to be thrown when done() is called multiple times in a test
259
- *
260
- * @public
261
- * @param {Runnable} runnable - Original runnable
262
- * @param {Error} [originalErr] - Original error, if any
263
- * @returns {Error} instance detailing the error condition
264
- * @static
265
- */
266
- function createMultipleDoneError(runnable, originalErr) {
267
- var title;
268
- try {
269
- title = format("<%s>", runnable.fullTitle());
270
- if (runnable.parent.root) title += " (of root suite)";
271
- } catch (ignored) {
272
- title = format("<%s> (of unknown suite)", runnable.title);
273
- }
274
- var message = format("done() called multiple times in %s %s", runnable.type ? runnable.type : "unknown runnable", title);
275
- if (runnable.file) message += format(" of file %s", runnable.file);
276
- if (originalErr) message += format("; in addition, done() received error: %s", originalErr);
277
- var err = new Error(message);
278
- err.code = constants.MULTIPLE_DONE;
279
- err.valueType = typeof originalErr;
280
- err.value = originalErr;
281
- return err;
282
- }
283
- /**
284
- * Creates an error object to be thrown when `.only()` is used with
285
- * `--forbid-only`.
286
- * @static
287
- * @public
288
- * @param {Mocha} mocha - Mocha instance
289
- * @returns {Error} Error with code {@link constants.FORBIDDEN_EXCLUSIVITY}
290
- */
291
- function createForbiddenExclusivityError(mocha) {
292
- var err = /* @__PURE__ */ new Error(mocha.isWorker ? "`.only` is not supported in parallel mode" : "`.only` forbidden by --forbid-only");
293
- err.code = constants.FORBIDDEN_EXCLUSIVITY;
294
- return err;
295
- }
296
- /**
297
- * Creates an error object to be thrown when a plugin definition is invalid
298
- * @static
299
- * @param {string} msg - Error message
300
- * @param {PluginDefinition} [pluginDef] - Problematic plugin definition
301
- * @public
302
- * @returns {Error} Error with code {@link constants.INVALID_PLUGIN_DEFINITION}
303
- */
304
- function createInvalidPluginDefinitionError(msg, pluginDef) {
305
- const err = new Error(msg);
306
- err.code = constants.INVALID_PLUGIN_DEFINITION;
307
- err.pluginDef = pluginDef;
308
- return err;
309
- }
310
- /**
311
- * Creates an error object to be thrown when a plugin implementation (user code) is invalid
312
- * @static
313
- * @param {string} msg - Error message
314
- * @param {Object} [opts] - Plugin definition and user-supplied implementation
315
- * @param {PluginDefinition} [opts.pluginDef] - Plugin Definition
316
- * @param {*} [opts.pluginImpl] - Plugin Implementation (user-supplied)
317
- * @public
318
- * @returns {Error} Error with code {@link constants.INVALID_PLUGIN_DEFINITION}
319
- */
320
- function createInvalidPluginImplementationError(msg, { pluginDef, pluginImpl } = {}) {
321
- const err = new Error(msg);
322
- err.code = constants.INVALID_PLUGIN_IMPLEMENTATION;
323
- err.pluginDef = pluginDef;
324
- err.pluginImpl = pluginImpl;
325
- return err;
326
- }
327
- /**
328
- * Creates an error object to be thrown when a runnable exceeds its allowed run time.
329
- * @static
330
- * @param {string} msg - Error message
331
- * @param {number} [timeout] - Timeout in ms
332
- * @param {string} [file] - File, if given
333
- * @returns {MochaTimeoutError}
334
- */
335
- function createTimeoutError(msg, timeout, file) {
336
- const err = new Error(msg);
337
- err.code = constants.TIMEOUT;
338
- err.timeout = timeout;
339
- err.file = file;
340
- return err;
341
- }
342
- /**
343
- * Creates an error object to be thrown when file is unparsable
344
- * @public
345
- * @static
346
- * @param {string} message - Error message to be displayed.
347
- * @returns {Error} Error with code {@link constants.UNPARSABLE_FILE}
348
- */
349
- function createUnparsableFileError(message) {
350
- var err = new Error(message);
351
- err.code = constants.UNPARSABLE_FILE;
352
- return err;
353
- }
354
- /**
355
- * Returns `true` if an error came out of Mocha.
356
- * _Can suffer from false negatives, but not false positives._
357
- * @static
358
- * @public
359
- * @param {*} err - Error, or anything
360
- * @returns {boolean}
361
- */
362
- const isMochaError = (err) => Boolean(err && typeof err === "object" && MOCHA_ERRORS.has(err.code));
363
- module.exports = {
364
- createFatalError,
365
- createForbiddenExclusivityError,
366
- createInvalidArgumentTypeError,
367
- createInvalidArgumentValueError,
368
- createInvalidExceptionError,
369
- createInvalidInterfaceError,
370
- createInvalidLegacyPluginError,
371
- createInvalidPluginDefinitionError,
372
- createInvalidPluginError,
373
- createInvalidPluginImplementationError,
374
- createInvalidReporterError,
375
- createMissingArgumentError,
376
- createMochaInstanceAlreadyDisposedError,
377
- createMochaInstanceAlreadyRunningError,
378
- createMultipleDoneError,
379
- createNoFilesMatchPatternError,
380
- createTimeoutError,
381
- createUnparsableFileError,
382
- createUnsupportedError,
383
- deprecate,
384
- isMochaError,
385
- warn
386
- };
387
- }) });
388
-
389
- //#endregion
390
- export default require_errors();
391
-
392
- export { require_errors };
@@ -1,86 +0,0 @@
1
- import { __commonJS } from "../../../../../../_virtual/rolldown_runtime.js";
2
- import { require_utils } from "./utils.js";
3
- import { require_runnable } from "./runnable.js";
4
-
5
- //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/hook.js
6
- var require_hook = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/hook.js": ((exports, module) => {
7
- var Runnable = require_runnable();
8
- const { inherits, constants } = require_utils();
9
- const { MOCHA_ID_PROP_NAME } = constants;
10
- /**
11
- * Expose `Hook`.
12
- */
13
- module.exports = Hook;
14
- /**
15
- * Initialize a new `Hook` with the given `title` and callback `fn`
16
- *
17
- * @class
18
- * @extends Runnable
19
- * @param {String} title
20
- * @param {Function} fn
21
- */
22
- function Hook(title, fn) {
23
- Runnable.call(this, title, fn);
24
- this.type = "hook";
25
- }
26
- /**
27
- * Inherit from `Runnable.prototype`.
28
- */
29
- inherits(Hook, Runnable);
30
- /**
31
- * Resets the state for a next run.
32
- */
33
- Hook.prototype.reset = function() {
34
- Runnable.prototype.reset.call(this);
35
- delete this._error;
36
- };
37
- /**
38
- * Get or set the test `err`.
39
- *
40
- * @memberof Hook
41
- * @public
42
- * @param {Error} err
43
- * @return {Error}
44
- */
45
- Hook.prototype.error = function(err) {
46
- if (!arguments.length) {
47
- err = this._error;
48
- this._error = null;
49
- return err;
50
- }
51
- this._error = err;
52
- };
53
- /**
54
- * Returns an object suitable for IPC.
55
- * Functions are represented by keys beginning with `$$`.
56
- * @private
57
- * @returns {Object}
58
- */
59
- Hook.prototype.serialize = function serialize() {
60
- return {
61
- $$currentRetry: this.currentRetry(),
62
- $$fullTitle: this.fullTitle(),
63
- $$isPending: Boolean(this.isPending()),
64
- $$titlePath: this.titlePath(),
65
- ctx: this.ctx && this.ctx.currentTest ? { currentTest: {
66
- title: this.ctx.currentTest.title,
67
- [MOCHA_ID_PROP_NAME]: this.ctx.currentTest.id
68
- } } : {},
69
- duration: this.duration,
70
- file: this.file,
71
- parent: {
72
- $$fullTitle: this.parent.fullTitle(),
73
- [MOCHA_ID_PROP_NAME]: this.parent.id
74
- },
75
- state: this.state,
76
- title: this.title,
77
- type: this.type,
78
- [MOCHA_ID_PROP_NAME]: this.id
79
- };
80
- };
81
- }) });
82
-
83
- //#endregion
84
- export default require_hook();
85
-
86
- export { require_hook };