@eggjs/mock 6.1.0-beta.3 → 6.1.0-beta.5

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 (104) hide show
  1. package/dist/_virtual/rolldown_runtime.js +24 -1
  2. package/dist/bootstrap.d.ts +1 -1
  3. package/dist/bootstrap.js +1 -1
  4. package/dist/index.js +0 -1
  5. package/dist/inject_mocha.d.ts +1 -0
  6. package/dist/inject_mocha.js +35 -0
  7. package/dist/node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js +142 -0
  8. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js +157 -0
  9. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js +97 -0
  10. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js +40 -0
  11. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js +812 -0
  12. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js +50 -0
  13. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js +68 -0
  14. package/dist/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js +752 -0
  15. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js +203 -0
  16. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js +209 -0
  17. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js +18 -0
  18. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js +215 -0
  19. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/dmp.js +24 -0
  20. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/xml.js +33 -0
  21. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/array.js +29 -0
  22. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/base.js +185 -0
  23. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/character.js +23 -0
  24. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/css.js +26 -0
  25. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/json.js +83 -0
  26. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/line.js +51 -0
  27. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/sentence.js +26 -0
  28. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/word.js +151 -0
  29. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.js +178 -0
  30. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/apply.js +168 -0
  31. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/create.js +301 -0
  32. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/line-endings.js +137 -0
  33. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/merge.js +367 -0
  34. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/parse.js +91 -0
  35. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/reverse.js +99 -0
  36. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/array.js +23 -0
  37. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/distance-iterator.js +30 -0
  38. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/params.js +22 -0
  39. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/string.js +97 -0
  40. package/dist/node_modules/.pnpm/escape-string-regexp@4.0.0/node_modules/escape-string-regexp/index.js +14 -0
  41. package/dist/node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js +16 -0
  42. package/dist/node_modules/.pnpm/he@1.2.0/node_modules/he/he.js +4093 -0
  43. package/dist/node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js +14 -0
  44. package/dist/node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js +27 -0
  45. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/index.js +12 -0
  46. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/context.js +83 -0
  47. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/error-constants.js +35 -0
  48. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/errors.js +392 -0
  49. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/hook.js +86 -0
  50. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/bdd.js +104 -0
  51. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/common.js +99 -0
  52. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/exports.js +65 -0
  53. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/index.js +18 -0
  54. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/qunit.js +95 -0
  55. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/tdd.js +105 -0
  56. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocha.js +1037 -0
  57. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocharc.js +24 -0
  58. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/buffered-worker-pool.js +152 -0
  59. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/esm-utils.js +74 -0
  60. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/file-unloader.js +22 -0
  61. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/parallel-buffered-runner.js +329 -0
  62. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/serializer.js +314 -0
  63. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/pending.js +22 -0
  64. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/base.js +417 -0
  65. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/doc.js +79 -0
  66. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/dot.js +75 -0
  67. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/html.js +283 -0
  68. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/index.js +40 -0
  69. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json-stream.js +90 -0
  70. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json.js +145 -0
  71. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/landing.js +107 -0
  72. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/list.js +77 -0
  73. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/markdown.js +106 -0
  74. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/min.js +57 -0
  75. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/nyan.js +233 -0
  76. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/progress.js +92 -0
  77. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/spec.js +91 -0
  78. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/tap.js +261 -0
  79. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/xunit.js +166 -0
  80. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runnable.js +346 -0
  81. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runner.js +922 -0
  82. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/stats-collector.js +72 -0
  83. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/suite.js +517 -0
  84. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/test.js +105 -0
  85. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/utils.js +505 -0
  86. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/package.js +225 -0
  87. package/dist/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js +124 -0
  88. package/dist/node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/index.js +11 -0
  89. package/dist/node_modules/.pnpm/serialize-javascript@6.0.2/node_modules/serialize-javascript/index.js +114 -0
  90. package/dist/node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js +76 -0
  91. package/dist/node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js +89 -0
  92. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Pool.js +366 -0
  93. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Promise.js +248 -0
  94. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/WorkerHandler.js +419 -0
  95. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/debug-port-allocator.js +27 -0
  96. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/environment.js +18 -0
  97. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/generated/embeddedWorker.js +16 -0
  98. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/index.js +63 -0
  99. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/transfer.js +21 -0
  100. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/validateOptions.js +9 -0
  101. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/worker.js +277 -0
  102. package/dist/register.d.ts +0 -2
  103. package/dist/register.js +1 -26
  104. package/package.json +10 -8
@@ -0,0 +1,77 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_utils } from "../utils.js";
3
+ import { require_runner } from "../runner.js";
4
+ import { require_base } from "./base.js";
5
+
6
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/list.js
7
+ var require_list = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/list.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../runner.js')} Runner
10
+ */
11
+ /**
12
+ * @module List
13
+ */
14
+ /**
15
+ * Module dependencies.
16
+ */
17
+ var Base = require_base();
18
+ var inherits = require_utils().inherits;
19
+ var constants = require_runner().constants;
20
+ var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
21
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
22
+ var EVENT_TEST_BEGIN = constants.EVENT_TEST_BEGIN;
23
+ var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
24
+ var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
25
+ var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
26
+ var color = Base.color;
27
+ var cursor = Base.cursor;
28
+ /**
29
+ * Expose `List`.
30
+ */
31
+ exports = module.exports = List;
32
+ /**
33
+ * Constructs a new `List` reporter instance.
34
+ *
35
+ * @public
36
+ * @class
37
+ * @memberof Mocha.reporters
38
+ * @extends Mocha.reporters.Base
39
+ * @param {Runner} runner - Instance triggers reporter actions.
40
+ * @param {Object} [options] - runner options
41
+ */
42
+ function List(runner, options) {
43
+ Base.call(this, runner, options);
44
+ var self = this;
45
+ var n = 0;
46
+ runner.on(EVENT_RUN_BEGIN, function() {
47
+ Base.consoleLog();
48
+ });
49
+ runner.on(EVENT_TEST_BEGIN, function(test) {
50
+ process.stdout.write(color("pass", " " + test.fullTitle() + ": "));
51
+ });
52
+ runner.on(EVENT_TEST_PENDING, function(test) {
53
+ var fmt = color("checkmark", " -") + color("pending", " %s");
54
+ Base.consoleLog(fmt, test.fullTitle());
55
+ });
56
+ runner.on(EVENT_TEST_PASS, function(test) {
57
+ var fmt = color("checkmark", " " + Base.symbols.ok) + color("pass", " %s: ") + color(test.speed, "%dms");
58
+ cursor.CR();
59
+ Base.consoleLog(fmt, test.fullTitle(), test.duration);
60
+ });
61
+ runner.on(EVENT_TEST_FAIL, function(test) {
62
+ cursor.CR();
63
+ Base.consoleLog(color("fail", " %d) %s"), ++n, test.fullTitle());
64
+ });
65
+ runner.once(EVENT_RUN_END, self.epilogue.bind(self));
66
+ }
67
+ /**
68
+ * Inherit from `Base.prototype`.
69
+ */
70
+ inherits(List, Base);
71
+ List.description = "like \"spec\" reporter but flat";
72
+ }) });
73
+
74
+ //#endregion
75
+ export default require_list();
76
+
77
+ export { require_list };
@@ -0,0 +1,106 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_utils } from "../utils.js";
3
+ import { require_runner } from "../runner.js";
4
+ import { require_base } from "./base.js";
5
+
6
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/markdown.js
7
+ var require_markdown = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/markdown.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../runner.js')} Runner
10
+ */
11
+ /**
12
+ * @module Markdown
13
+ */
14
+ /**
15
+ * Module dependencies.
16
+ */
17
+ var Base = require_base();
18
+ var utils = require_utils();
19
+ var constants = require_runner().constants;
20
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
21
+ var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
22
+ var EVENT_SUITE_END = constants.EVENT_SUITE_END;
23
+ var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
24
+ /**
25
+ * Constants
26
+ */
27
+ var SUITE_PREFIX = "$";
28
+ /**
29
+ * Expose `Markdown`.
30
+ */
31
+ exports = module.exports = Markdown;
32
+ /**
33
+ * Constructs a new `Markdown` reporter instance.
34
+ *
35
+ * @public
36
+ * @class
37
+ * @memberof Mocha.reporters
38
+ * @extends Mocha.reporters.Base
39
+ * @param {Runner} runner - Instance triggers reporter actions.
40
+ * @param {Object} [options] - runner options
41
+ */
42
+ function Markdown(runner, options) {
43
+ Base.call(this, runner, options);
44
+ var level = 0;
45
+ var buf = "";
46
+ function title(str) {
47
+ return Array(level).join("#") + " " + str;
48
+ }
49
+ function mapTOC(suite, obj) {
50
+ var ret = obj;
51
+ var key = SUITE_PREFIX + suite.title;
52
+ obj = obj[key] = obj[key] || { suite };
53
+ suite.suites.forEach(function(suite$1) {
54
+ mapTOC(suite$1, obj);
55
+ });
56
+ return ret;
57
+ }
58
+ function stringifyTOC(obj, level$1) {
59
+ ++level$1;
60
+ var buf$1 = "";
61
+ var link;
62
+ for (var key in obj) {
63
+ if (key === "suite") continue;
64
+ if (key !== SUITE_PREFIX) {
65
+ link = " - [" + key.substring(1) + "]";
66
+ link += "(#" + utils.slug(obj[key].suite.fullTitle()) + ")\n";
67
+ buf$1 += Array(level$1).join(" ") + link;
68
+ }
69
+ buf$1 += stringifyTOC(obj[key], level$1);
70
+ }
71
+ return buf$1;
72
+ }
73
+ function generateTOC(suite) {
74
+ var obj = mapTOC(suite, {});
75
+ return stringifyTOC(obj, 0);
76
+ }
77
+ generateTOC(runner.suite);
78
+ runner.on(EVENT_SUITE_BEGIN, function(suite) {
79
+ ++level;
80
+ var slug = utils.slug(suite.fullTitle());
81
+ buf += "<a name=\"" + slug + "\"></a>\n";
82
+ buf += title(suite.title) + "\n";
83
+ });
84
+ runner.on(EVENT_SUITE_END, function() {
85
+ --level;
86
+ });
87
+ runner.on(EVENT_TEST_PASS, function(test) {
88
+ var code = utils.clean(test.body);
89
+ buf += test.title + ".\n";
90
+ buf += "\n```js\n";
91
+ buf += code + "\n";
92
+ buf += "```\n\n";
93
+ });
94
+ runner.once(EVENT_RUN_END, function() {
95
+ process.stdout.write("# TOC\n");
96
+ process.stdout.write(generateTOC(runner.suite));
97
+ process.stdout.write(buf);
98
+ });
99
+ }
100
+ Markdown.description = "GitHub Flavored Markdown";
101
+ }) });
102
+
103
+ //#endregion
104
+ export default require_markdown();
105
+
106
+ export { require_markdown };
@@ -0,0 +1,57 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_utils } from "../utils.js";
3
+ import { require_runner } from "../runner.js";
4
+ import { require_base } from "./base.js";
5
+
6
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/min.js
7
+ var require_min = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/min.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../runner.js')} Runner
10
+ */
11
+ /**
12
+ * @module Min
13
+ */
14
+ /**
15
+ * Module dependencies.
16
+ */
17
+ var Base = require_base();
18
+ var inherits = require_utils().inherits;
19
+ var constants = require_runner().constants;
20
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
21
+ var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
22
+ /**
23
+ * Expose `Min`.
24
+ */
25
+ exports = module.exports = Min;
26
+ /**
27
+ * Constructs a new `Min` reporter instance.
28
+ *
29
+ * @description
30
+ * This minimal test reporter is best used with '--watch'.
31
+ *
32
+ * @public
33
+ * @class
34
+ * @memberof Mocha.reporters
35
+ * @extends Mocha.reporters.Base
36
+ * @param {Runner} runner - Instance triggers reporter actions.
37
+ * @param {Object} [options] - runner options
38
+ */
39
+ function Min(runner, options) {
40
+ Base.call(this, runner, options);
41
+ runner.on(EVENT_RUN_BEGIN, function() {
42
+ process.stdout.write("\x1B[2J");
43
+ process.stdout.write("\x1B[1;3H");
44
+ });
45
+ runner.once(EVENT_RUN_END, this.epilogue.bind(this));
46
+ }
47
+ /**
48
+ * Inherit from `Base.prototype`.
49
+ */
50
+ inherits(Min, Base);
51
+ Min.description = "essentially just a summary";
52
+ }) });
53
+
54
+ //#endregion
55
+ export default require_min();
56
+
57
+ export { require_min };
@@ -0,0 +1,233 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_utils } from "../utils.js";
3
+ import { require_runner } from "../runner.js";
4
+ import { require_base } from "./base.js";
5
+
6
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/nyan.js
7
+ var require_nyan = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/nyan.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../runner.js')} Runner
10
+ */
11
+ /**
12
+ * @module Nyan
13
+ */
14
+ /**
15
+ * Module dependencies.
16
+ */
17
+ var Base = require_base();
18
+ var constants = require_runner().constants;
19
+ var inherits = require_utils().inherits;
20
+ var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
21
+ var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
22
+ var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
23
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
24
+ var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
25
+ /**
26
+ * Expose `Dot`.
27
+ */
28
+ exports = module.exports = NyanCat;
29
+ /**
30
+ * Constructs a new `Nyan` reporter instance.
31
+ *
32
+ * @public
33
+ * @class Nyan
34
+ * @memberof Mocha.reporters
35
+ * @extends Mocha.reporters.Base
36
+ * @param {Runner} runner - Instance triggers reporter actions.
37
+ * @param {Object} [options] - runner options
38
+ */
39
+ function NyanCat(runner, options) {
40
+ Base.call(this, runner, options);
41
+ var self = this;
42
+ var width = Base.window.width * .75 | 0;
43
+ var nyanCatWidth = this.nyanCatWidth = 11;
44
+ this.colorIndex = 0;
45
+ this.numberOfLines = 4;
46
+ this.rainbowColors = self.generateColors();
47
+ this.scoreboardWidth = 5;
48
+ this.tick = 0;
49
+ this.trajectories = [
50
+ [],
51
+ [],
52
+ [],
53
+ []
54
+ ];
55
+ this.trajectoryWidthMax = width - nyanCatWidth;
56
+ runner.on(EVENT_RUN_BEGIN, function() {
57
+ Base.cursor.hide();
58
+ self.draw();
59
+ });
60
+ runner.on(EVENT_TEST_PENDING, function() {
61
+ self.draw();
62
+ });
63
+ runner.on(EVENT_TEST_PASS, function() {
64
+ self.draw();
65
+ });
66
+ runner.on(EVENT_TEST_FAIL, function() {
67
+ self.draw();
68
+ });
69
+ runner.once(EVENT_RUN_END, function() {
70
+ Base.cursor.show();
71
+ for (var i = 0; i < self.numberOfLines; i++) process.stdout.write("\n");
72
+ self.epilogue();
73
+ });
74
+ }
75
+ /**
76
+ * Inherit from `Base.prototype`.
77
+ */
78
+ inherits(NyanCat, Base);
79
+ /**
80
+ * Draw the nyan cat
81
+ *
82
+ * @private
83
+ */
84
+ NyanCat.prototype.draw = function() {
85
+ this.appendRainbow();
86
+ this.drawScoreboard();
87
+ this.drawRainbow();
88
+ this.drawNyanCat();
89
+ this.tick = !this.tick;
90
+ };
91
+ /**
92
+ * Draw the "scoreboard" showing the number
93
+ * of passes, failures and pending tests.
94
+ *
95
+ * @private
96
+ */
97
+ NyanCat.prototype.drawScoreboard = function() {
98
+ var stats = this.stats;
99
+ function draw(type, n) {
100
+ process.stdout.write(" ");
101
+ process.stdout.write(Base.color(type, n));
102
+ process.stdout.write("\n");
103
+ }
104
+ draw("green", stats.passes);
105
+ draw("fail", stats.failures);
106
+ draw("pending", stats.pending);
107
+ process.stdout.write("\n");
108
+ this.cursorUp(this.numberOfLines);
109
+ };
110
+ /**
111
+ * Append the rainbow.
112
+ *
113
+ * @private
114
+ */
115
+ NyanCat.prototype.appendRainbow = function() {
116
+ var segment = this.tick ? "_" : "-";
117
+ var rainbowified = this.rainbowify(segment);
118
+ for (var index = 0; index < this.numberOfLines; index++) {
119
+ var trajectory = this.trajectories[index];
120
+ if (trajectory.length >= this.trajectoryWidthMax) trajectory.shift();
121
+ trajectory.push(rainbowified);
122
+ }
123
+ };
124
+ /**
125
+ * Draw the rainbow.
126
+ *
127
+ * @private
128
+ */
129
+ NyanCat.prototype.drawRainbow = function() {
130
+ var self = this;
131
+ this.trajectories.forEach(function(line) {
132
+ process.stdout.write("\x1B[" + self.scoreboardWidth + "C");
133
+ process.stdout.write(line.join(""));
134
+ process.stdout.write("\n");
135
+ });
136
+ this.cursorUp(this.numberOfLines);
137
+ };
138
+ /**
139
+ * Draw the nyan cat
140
+ *
141
+ * @private
142
+ */
143
+ NyanCat.prototype.drawNyanCat = function() {
144
+ var self = this;
145
+ var dist = "\x1B[" + (this.scoreboardWidth + this.trajectories[0].length) + "C";
146
+ var padding = "";
147
+ process.stdout.write(dist);
148
+ process.stdout.write("_,------,");
149
+ process.stdout.write("\n");
150
+ process.stdout.write(dist);
151
+ padding = self.tick ? " " : " ";
152
+ process.stdout.write("_|" + padding + "/\\_/\\ ");
153
+ process.stdout.write("\n");
154
+ process.stdout.write(dist);
155
+ padding = self.tick ? "_" : "__";
156
+ var tail = self.tick ? "~" : "^";
157
+ process.stdout.write(tail + "|" + padding + this.face() + " ");
158
+ process.stdout.write("\n");
159
+ process.stdout.write(dist);
160
+ padding = self.tick ? " " : " ";
161
+ process.stdout.write(padding + "\"\" \"\" ");
162
+ process.stdout.write("\n");
163
+ this.cursorUp(this.numberOfLines);
164
+ };
165
+ /**
166
+ * Draw nyan cat face.
167
+ *
168
+ * @private
169
+ * @return {string}
170
+ */
171
+ NyanCat.prototype.face = function() {
172
+ var stats = this.stats;
173
+ if (stats.failures) return "( x .x)";
174
+ else if (stats.pending) return "( o .o)";
175
+ else if (stats.passes) return "( ^ .^)";
176
+ return "( - .-)";
177
+ };
178
+ /**
179
+ * Move cursor up `n`.
180
+ *
181
+ * @private
182
+ * @param {number} n
183
+ */
184
+ NyanCat.prototype.cursorUp = function(n) {
185
+ process.stdout.write("\x1B[" + n + "A");
186
+ };
187
+ /**
188
+ * Move cursor down `n`.
189
+ *
190
+ * @private
191
+ * @param {number} n
192
+ */
193
+ NyanCat.prototype.cursorDown = function(n) {
194
+ process.stdout.write("\x1B[" + n + "B");
195
+ };
196
+ /**
197
+ * Generate rainbow colors.
198
+ *
199
+ * @private
200
+ * @return {Array}
201
+ */
202
+ NyanCat.prototype.generateColors = function() {
203
+ var colors = [];
204
+ for (var i = 0; i < 42; i++) {
205
+ var pi3 = Math.floor(Math.PI / 3);
206
+ var n = i * (1 / 6);
207
+ var r = Math.floor(3 * Math.sin(n) + 3);
208
+ var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);
209
+ var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);
210
+ colors.push(36 * r + 6 * g + b + 16);
211
+ }
212
+ return colors;
213
+ };
214
+ /**
215
+ * Apply rainbow to the given `str`.
216
+ *
217
+ * @private
218
+ * @param {string} str
219
+ * @return {string}
220
+ */
221
+ NyanCat.prototype.rainbowify = function(str) {
222
+ if (!Base.useColors) return str;
223
+ var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
224
+ this.colorIndex += 1;
225
+ return "\x1B[38;5;" + color + "m" + str + "\x1B[0m";
226
+ };
227
+ NyanCat.description = "\"nyan cat\"";
228
+ }) });
229
+
230
+ //#endregion
231
+ export default require_nyan();
232
+
233
+ export { require_nyan };
@@ -0,0 +1,92 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_utils } from "../utils.js";
3
+ import { require_runner } from "../runner.js";
4
+ import { require_base } from "./base.js";
5
+
6
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/progress.js
7
+ var require_progress = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/progress.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../runner.js')} Runner
10
+ */
11
+ /**
12
+ * @module Progress
13
+ */
14
+ /**
15
+ * Module dependencies.
16
+ */
17
+ var Base = require_base();
18
+ var constants = require_runner().constants;
19
+ var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
20
+ var EVENT_TEST_END = constants.EVENT_TEST_END;
21
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
22
+ var inherits = require_utils().inherits;
23
+ var color = Base.color;
24
+ var cursor = Base.cursor;
25
+ /**
26
+ * Expose `Progress`.
27
+ */
28
+ exports = module.exports = Progress;
29
+ /**
30
+ * General progress bar color.
31
+ */
32
+ Base.colors.progress = 90;
33
+ /**
34
+ * Constructs a new `Progress` reporter instance.
35
+ *
36
+ * @public
37
+ * @class
38
+ * @memberof Mocha.reporters
39
+ * @extends Mocha.reporters.Base
40
+ * @param {Runner} runner - Instance triggers reporter actions.
41
+ * @param {Object} [options] - runner options
42
+ */
43
+ function Progress(runner, options) {
44
+ Base.call(this, runner, options);
45
+ var self = this;
46
+ var width = Base.window.width * .5 | 0;
47
+ var total = runner.total;
48
+ var complete = 0;
49
+ var lastN = -1;
50
+ options = options || {};
51
+ var reporterOptions = options.reporterOptions || {};
52
+ options.open = reporterOptions.open || "[";
53
+ options.complete = reporterOptions.complete || "▬";
54
+ options.incomplete = reporterOptions.incomplete || Base.symbols.dot;
55
+ options.close = reporterOptions.close || "]";
56
+ options.verbose = reporterOptions.verbose || false;
57
+ runner.on(EVENT_RUN_BEGIN, function() {
58
+ process.stdout.write("\n");
59
+ cursor.hide();
60
+ });
61
+ runner.on(EVENT_TEST_END, function() {
62
+ complete++;
63
+ var percent = complete / total;
64
+ var n = width * percent | 0;
65
+ var i = width - n;
66
+ if (n === lastN && !options.verbose) return;
67
+ lastN = n;
68
+ cursor.CR();
69
+ process.stdout.write("\x1B[J");
70
+ process.stdout.write(color("progress", " " + options.open));
71
+ process.stdout.write(Array(n).join(options.complete));
72
+ process.stdout.write(Array(i).join(options.incomplete));
73
+ process.stdout.write(color("progress", options.close));
74
+ if (options.verbose) process.stdout.write(color("progress", " " + complete + " of " + total));
75
+ });
76
+ runner.once(EVENT_RUN_END, function() {
77
+ cursor.show();
78
+ process.stdout.write("\n");
79
+ self.epilogue();
80
+ });
81
+ }
82
+ /**
83
+ * Inherit from `Base.prototype`.
84
+ */
85
+ inherits(Progress, Base);
86
+ Progress.description = "a progress bar";
87
+ }) });
88
+
89
+ //#endregion
90
+ export default require_progress();
91
+
92
+ export { require_progress };
@@ -0,0 +1,91 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_utils } from "../utils.js";
3
+ import { require_runner } from "../runner.js";
4
+ import { require_base } from "./base.js";
5
+
6
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/spec.js
7
+ var require_spec = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/spec.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../runner.js')} Runner
10
+ * @typedef {import('../test.js')} Test
11
+ */
12
+ /**
13
+ * @module Spec
14
+ */
15
+ /**
16
+ * Module dependencies.
17
+ */
18
+ var Base = require_base();
19
+ var constants = require_runner().constants;
20
+ var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
21
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
22
+ var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
23
+ var EVENT_SUITE_END = constants.EVENT_SUITE_END;
24
+ var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
25
+ var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
26
+ var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
27
+ var inherits = require_utils().inherits;
28
+ var color = Base.color;
29
+ /**
30
+ * Expose `Spec`.
31
+ */
32
+ exports = module.exports = Spec;
33
+ /**
34
+ * Constructs a new `Spec` reporter instance.
35
+ *
36
+ * @public
37
+ * @class
38
+ * @memberof Mocha.reporters
39
+ * @extends Mocha.reporters.Base
40
+ * @param {Runner} runner - Instance triggers reporter actions.
41
+ * @param {Object} [options] - runner options
42
+ */
43
+ function Spec(runner, options) {
44
+ Base.call(this, runner, options);
45
+ var self = this;
46
+ var indents = 0;
47
+ var n = 0;
48
+ function indent() {
49
+ return Array(indents).join(" ");
50
+ }
51
+ runner.on(EVENT_RUN_BEGIN, function() {
52
+ Base.consoleLog();
53
+ });
54
+ runner.on(EVENT_SUITE_BEGIN, function(suite) {
55
+ ++indents;
56
+ Base.consoleLog(color("suite", "%s%s"), indent(), suite.title);
57
+ });
58
+ runner.on(EVENT_SUITE_END, function() {
59
+ --indents;
60
+ if (indents === 1) Base.consoleLog();
61
+ });
62
+ runner.on(EVENT_TEST_PENDING, function(test) {
63
+ var fmt = indent() + color("pending", " - %s");
64
+ Base.consoleLog(fmt, test.title);
65
+ });
66
+ runner.on(EVENT_TEST_PASS, function(test) {
67
+ var fmt;
68
+ if (test.speed === "fast") {
69
+ fmt = indent() + color("checkmark", " " + Base.symbols.ok) + color("pass", " %s");
70
+ Base.consoleLog(fmt, test.title);
71
+ } else {
72
+ fmt = indent() + color("checkmark", " " + Base.symbols.ok) + color("pass", " %s") + color(test.speed, " (%dms)");
73
+ Base.consoleLog(fmt, test.title, test.duration);
74
+ }
75
+ });
76
+ runner.on(EVENT_TEST_FAIL, function(test) {
77
+ Base.consoleLog(indent() + color("fail", " %d) %s"), ++n, test.title);
78
+ });
79
+ runner.once(EVENT_RUN_END, self.epilogue.bind(self));
80
+ }
81
+ /**
82
+ * Inherit from `Base.prototype`.
83
+ */
84
+ inherits(Spec, Base);
85
+ Spec.description = "hierarchical & verbose [default]";
86
+ }) });
87
+
88
+ //#endregion
89
+ export default require_spec();
90
+
91
+ export { require_spec };