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

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.3/node_modules/workerpool/src/Pool.js +366 -0
  93. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/Promise.js +248 -0
  94. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/WorkerHandler.js +419 -0
  95. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/debug-port-allocator.js +27 -0
  96. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/environment.js +18 -0
  97. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/generated/embeddedWorker.js +16 -0
  98. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/index.js +63 -0
  99. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/transfer.js +21 -0
  100. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/validateOptions.js +9 -0
  101. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/worker.js +281 -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,281 @@
1
+ import { __commonJS, __require } from "../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_Promise } from "./Promise.js";
3
+ import { require_transfer } from "./transfer.js";
4
+
5
+ //#region ../../node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/worker.js
6
+ var require_worker = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/worker.js": ((exports) => {
7
+ /**
8
+ * worker must be started as a child process or a web worker.
9
+ * It listens for RPC messages from the parent process.
10
+ */
11
+ var Transfer = require_transfer();
12
+ /**
13
+ * worker must handle async cleanup handlers. Use custom Promise implementation.
14
+ */
15
+ var Promise$1 = require_Promise().Promise;
16
+ /**
17
+ * Special message sent by parent which causes the worker to terminate itself.
18
+ * Not a "message object"; this string is the entire message.
19
+ */
20
+ var TERMINATE_METHOD_ID = "__workerpool-terminate__";
21
+ /**
22
+ * Special message by parent which causes a child process worker to perform cleaup
23
+ * steps before determining if the child process worker should be terminated.
24
+ */
25
+ var CLEANUP_METHOD_ID = "__workerpool-cleanup__";
26
+ var TIMEOUT_DEFAULT = 1e3;
27
+ var worker = { exit: function() {} };
28
+ var publicWorker = {
29
+ addAbortListener: function(listener) {
30
+ worker.abortListeners.push(listener);
31
+ },
32
+ emit: worker.emit
33
+ };
34
+ if (typeof self !== "undefined" && typeof postMessage === "function" && typeof addEventListener === "function") {
35
+ worker.on = function(event, callback) {
36
+ addEventListener(event, function(message) {
37
+ callback(message.data);
38
+ });
39
+ };
40
+ worker.send = function(message, transfer) {
41
+ transfer ? postMessage(message, transfer) : postMessage(message);
42
+ };
43
+ } else if (typeof process !== "undefined") {
44
+ var WorkerThreads;
45
+ try {
46
+ WorkerThreads = __require("worker_threads");
47
+ } catch (error) {
48
+ if (typeof error === "object" && error !== null && error.code === "MODULE_NOT_FOUND") {} else throw error;
49
+ }
50
+ if (WorkerThreads && WorkerThreads.parentPort !== null) {
51
+ var parentPort = WorkerThreads.parentPort;
52
+ worker.send = parentPort.postMessage.bind(parentPort);
53
+ worker.on = parentPort.on.bind(parentPort);
54
+ worker.exit = process.exit.bind(process);
55
+ } else {
56
+ worker.on = process.on.bind(process);
57
+ worker.send = function(message) {
58
+ process.send(message);
59
+ };
60
+ worker.on("disconnect", function() {
61
+ process.exit(1);
62
+ });
63
+ worker.exit = process.exit.bind(process);
64
+ }
65
+ } else throw new Error("Script must be executed as a worker");
66
+ function convertError(error) {
67
+ return Object.getOwnPropertyNames(error).reduce(function(product, name) {
68
+ return Object.defineProperty(product, name, {
69
+ value: error[name],
70
+ enumerable: true
71
+ });
72
+ }, {});
73
+ }
74
+ /**
75
+ * Test whether a value is a Promise via duck typing.
76
+ * @param {*} value
77
+ * @returns {boolean} Returns true when given value is an object
78
+ * having functions `then` and `catch`.
79
+ */
80
+ function isPromise(value) {
81
+ return value && typeof value.then === "function" && typeof value.catch === "function";
82
+ }
83
+ worker.methods = {};
84
+ /**
85
+ * Execute a function with provided arguments
86
+ * @param {String} fn Stringified function
87
+ * @param {Array} [args] Function arguments
88
+ * @returns {*}
89
+ */
90
+ worker.methods.run = function run(fn, args) {
91
+ var f = new Function("return (" + fn + ").apply(this, arguments);");
92
+ f.worker = publicWorker;
93
+ return f.apply(f, args);
94
+ };
95
+ /**
96
+ * Get a list with methods available on this worker
97
+ * @return {String[]} methods
98
+ */
99
+ worker.methods.methods = function methods() {
100
+ return Object.keys(worker.methods);
101
+ };
102
+ /**
103
+ * Custom handler for when the worker is terminated.
104
+ */
105
+ worker.terminationHandler = void 0;
106
+ worker.abortListenerTimeout = TIMEOUT_DEFAULT;
107
+ /**
108
+ * Abort handlers for resolving errors which may cause a timeout or cancellation
109
+ * to occur from a worker context
110
+ */
111
+ worker.abortListeners = [];
112
+ /**
113
+ * Cleanup and exit the worker.
114
+ * @param {Number} code
115
+ * @returns {Promise<void>}
116
+ */
117
+ worker.terminateAndExit = function(code) {
118
+ var _exit = function() {
119
+ worker.exit(code);
120
+ };
121
+ if (!worker.terminationHandler) return _exit();
122
+ var result = worker.terminationHandler(code);
123
+ if (isPromise(result)) {
124
+ result.then(_exit, _exit);
125
+ return result;
126
+ } else {
127
+ _exit();
128
+ return new Promise$1(function(_resolve, reject) {
129
+ reject(/* @__PURE__ */ new Error("Worker terminating"));
130
+ });
131
+ }
132
+ };
133
+ /**
134
+ * Called within the worker message handler to run abort handlers if registered to perform cleanup operations.
135
+ * @param {Integer} [requestId] id of task which is currently executing in the worker
136
+ * @return {Promise<void>}
137
+ */
138
+ worker.cleanup = function(requestId) {
139
+ if (!worker.abortListeners.length) {
140
+ worker.send({
141
+ id: requestId,
142
+ method: CLEANUP_METHOD_ID,
143
+ error: convertError(/* @__PURE__ */ new Error("Worker terminating"))
144
+ });
145
+ return new Promise$1(function(resolve) {
146
+ resolve();
147
+ });
148
+ }
149
+ var _exit = function() {
150
+ worker.exit();
151
+ };
152
+ var _abort = function() {
153
+ if (!worker.abortListeners.length) worker.abortListeners = [];
154
+ };
155
+ const promises = worker.abortListeners.map((listener) => listener());
156
+ let timerId;
157
+ const timeoutPromise = new Promise$1((_resolve, reject) => {
158
+ timerId = setTimeout(function() {
159
+ reject(/* @__PURE__ */ new Error("Timeout occured waiting for abort handler, killing worker"));
160
+ }, worker.abortListenerTimeout);
161
+ });
162
+ const settlePromise = Promise$1.all(promises).then(function() {
163
+ clearTimeout(timerId);
164
+ _abort();
165
+ }, function() {
166
+ clearTimeout(timerId);
167
+ _exit();
168
+ });
169
+ return new Promise$1(function(resolve, reject) {
170
+ settlePromise.then(resolve, reject);
171
+ timeoutPromise.then(resolve, reject);
172
+ }).then(function() {
173
+ worker.send({
174
+ id: requestId,
175
+ method: CLEANUP_METHOD_ID,
176
+ error: null
177
+ });
178
+ }, function(err) {
179
+ worker.send({
180
+ id: requestId,
181
+ method: CLEANUP_METHOD_ID,
182
+ error: err ? convertError(err) : null
183
+ });
184
+ });
185
+ };
186
+ var currentRequestId = null;
187
+ worker.on("message", function(request) {
188
+ if (request === TERMINATE_METHOD_ID) return worker.terminateAndExit(0);
189
+ if (request.method === CLEANUP_METHOD_ID) return worker.cleanup(request.id);
190
+ try {
191
+ var method = worker.methods[request.method];
192
+ if (method) {
193
+ currentRequestId = request.id;
194
+ var result = method.apply(method, request.params);
195
+ if (isPromise(result)) result.then(function(result$1) {
196
+ if (result$1 instanceof Transfer) worker.send({
197
+ id: request.id,
198
+ result: result$1.message,
199
+ error: null
200
+ }, result$1.transfer);
201
+ else worker.send({
202
+ id: request.id,
203
+ result: result$1,
204
+ error: null
205
+ });
206
+ currentRequestId = null;
207
+ }).catch(function(err) {
208
+ worker.send({
209
+ id: request.id,
210
+ result: null,
211
+ error: convertError(err)
212
+ });
213
+ currentRequestId = null;
214
+ });
215
+ else {
216
+ if (result instanceof Transfer) worker.send({
217
+ id: request.id,
218
+ result: result.message,
219
+ error: null
220
+ }, result.transfer);
221
+ else worker.send({
222
+ id: request.id,
223
+ result,
224
+ error: null
225
+ });
226
+ currentRequestId = null;
227
+ }
228
+ } else throw new Error("Unknown method \"" + request.method + "\"");
229
+ } catch (err) {
230
+ worker.send({
231
+ id: request.id,
232
+ result: null,
233
+ error: convertError(err)
234
+ });
235
+ }
236
+ });
237
+ /**
238
+ * Register methods to the worker
239
+ * @param {Object} [methods]
240
+ * @param {import('./types.js').WorkerRegisterOptions} [options]
241
+ */
242
+ worker.register = function(methods, options) {
243
+ if (methods) {
244
+ for (var name in methods) if (methods.hasOwnProperty(name)) {
245
+ worker.methods[name] = methods[name];
246
+ worker.methods[name].worker = publicWorker;
247
+ }
248
+ }
249
+ if (options) {
250
+ worker.terminationHandler = options.onTerminate;
251
+ worker.abortListenerTimeout = options.abortListenerTimeout || TIMEOUT_DEFAULT;
252
+ }
253
+ worker.send("ready");
254
+ };
255
+ worker.emit = function(payload) {
256
+ if (currentRequestId) {
257
+ if (payload instanceof Transfer) {
258
+ worker.send({
259
+ id: currentRequestId,
260
+ isEvent: true,
261
+ payload: payload.message
262
+ }, payload.transfer);
263
+ return;
264
+ }
265
+ worker.send({
266
+ id: currentRequestId,
267
+ isEvent: true,
268
+ payload
269
+ });
270
+ }
271
+ };
272
+ if (typeof exports !== "undefined") {
273
+ exports.add = worker.register;
274
+ exports.emit = worker.emit;
275
+ }
276
+ }) });
277
+
278
+ //#endregion
279
+ export default require_worker();
280
+
281
+ export { require_worker };
@@ -1,5 +1,3 @@
1
- import "mocha";
2
-
3
1
  //#region src/register.d.ts
4
2
  declare function mochaGlobalSetup(): Promise<void>;
5
3
  declare function mochaGlobalTeardown(): Promise<void>;
package/dist/register.js CHANGED
@@ -1,11 +1,8 @@
1
- import { __require } from "./_virtual/rolldown_runtime.js";
2
1
  import { closeAgent, setupAgent } from "./lib/agent_handler.js";
3
2
  import { getApp } from "./lib/app_handler.js";
4
3
  import { mm as proxyMock } from "./index.js";
5
- import { injectContext } from "./lib/inject_context.js";
6
- import { createRequire } from "node:module";
4
+ import "./inject_mocha.js";
7
5
  import { debuglog } from "node:util";
8
- import "mocha";
9
6
 
10
7
  //#region src/register.ts
11
8
  const debug = debuglog("egg/mock/register");
@@ -38,28 +35,6 @@ const mochaHooks = {
38
35
  if (app) await app.close();
39
36
  }
40
37
  };
41
- /**
42
- * Find active node mocha instances.
43
- */
44
- function findNodeJSMocha() {
45
- let children;
46
- if (typeof __require === "function") children = __require.cache || {};
47
- else {
48
- children = createRequire(process.cwd()).cache || {};
49
- debug("createRequire on esm");
50
- }
51
- return Object.keys(children).filter(function(child) {
52
- const val = children[child].exports;
53
- return typeof val === "function" && val.name === "Mocha";
54
- }).map(function(child) {
55
- return children[child].exports;
56
- });
57
- }
58
- const modules = findNodeJSMocha();
59
- for (const module of modules) {
60
- if (!module) continue;
61
- injectContext(module);
62
- }
63
38
 
64
39
  //#endregion
65
40
  export { mochaGlobalSetup, mochaGlobalTeardown, mochaHooks };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eggjs/mock",
3
- "version": "6.1.0-beta.3",
3
+ "version": "6.1.0-beta.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -18,6 +18,7 @@
18
18
  "./app/extend/application": "./dist/app/extend/application.js",
19
19
  "./app/middleware/cluster_app_mock": "./dist/app/middleware/cluster_app_mock.js",
20
20
  "./bootstrap": "./dist/bootstrap.js",
21
+ "./inject_mocha": "./dist/inject_mocha.js",
21
22
  "./lib/agent_handler": "./dist/lib/agent_handler.js",
22
23
  "./lib/app": "./dist/lib/app.js",
23
24
  "./lib/app_handler": "./dist/lib/app_handler.js",
@@ -64,7 +65,6 @@
64
65
  "node": ">= 20.19.0"
65
66
  },
66
67
  "dependencies": {
67
- "@eggjs/supertest": "",
68
68
  "coffee": "5",
69
69
  "detect-port": "^2.1.0",
70
70
  "egg-logger": "^3.5.0",
@@ -76,9 +76,10 @@
76
76
  "sdk-base": "^5.0.1",
77
77
  "urllib": "^4.6.11",
78
78
  "utility": "^2.5.0",
79
- "@eggjs/core": "6.6.0-beta.3",
80
- "@eggjs/utils": "4.5.0-beta.3",
81
- "@eggjs/extend2": "4.1.0-beta.3"
79
+ "@eggjs/core": "6.6.0-beta.4",
80
+ "@eggjs/extend2": "4.1.0-beta.4",
81
+ "@eggjs/supertest": "8.3.0-beta.4",
82
+ "@eggjs/utils": "4.5.0-beta.4"
82
83
  },
83
84
  "devDependencies": {
84
85
  "@eggjs/tegg": "^3.2.2",
@@ -92,13 +93,14 @@
92
93
  "pedding": "^2.0.1",
93
94
  "tsd": "^0.33.0",
94
95
  "tsdown": "^0.15.0",
95
- "typescript": "5",
96
- "egg": "4.1.0-beta.3",
97
- "@eggjs/tsconfig": "3.1.0-beta.3"
96
+ "typescript": "5.9.2",
97
+ "@eggjs/tsconfig": "3.1.0-beta.4",
98
+ "egg": "4.1.0-beta.4"
98
99
  },
99
100
  "scripts": {
100
101
  "build": "tsdown",
101
102
  "lint": "oxlint",
103
+ "typecheck": "tsc --noEmit",
102
104
  "test": "vitest run"
103
105
  }
104
106
  }