@eggjs/mock 7.0.0-beta.18 → 7.0.0-beta.20

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 (78) hide show
  1. package/dist/agent-BKYkjoCx.js +111 -0
  2. package/dist/agent-CHCe8tnW.d.ts +24 -0
  3. package/dist/agent-DZ_fHoxJ.js +48 -0
  4. package/dist/agent_handler-DeUtoRVT.js +26 -0
  5. package/dist/app/extend/agent.d.ts +1 -1
  6. package/dist/app/extend/agent.js +3 -46
  7. package/dist/app/extend/application.d.ts +4 -174
  8. package/dist/app/extend/application.js +7 -383
  9. package/dist/app-6Bn3F5Uw.js +252 -0
  10. package/dist/app-CoypamK1.js +99 -0
  11. package/dist/app-l47a-gqT.d.ts +7 -0
  12. package/dist/app_handler-CkiK6fyC.js +55 -0
  13. package/dist/app_handler-Gp5J9X-v.d.ts +9 -0
  14. package/dist/application-BPpvw5dg.d.ts +175 -0
  15. package/dist/application-LrKwuOKn.js +385 -0
  16. package/dist/bootstrap.d.ts +9 -3
  17. package/dist/bootstrap.js +20 -3
  18. package/dist/cluster-CA_hr9eV.js +283 -0
  19. package/dist/cluster-RTfUwmUd.d.ts +126 -0
  20. package/dist/context-BIduDy1M.js +10 -0
  21. package/dist/format_options-LRnReKde.js +65 -0
  22. package/dist/index-BtBMDZg8.d.ts +78 -0
  23. package/dist/index.d.ts +10 -81
  24. package/dist/index.js +20 -45
  25. package/dist/inject_context-BxpcF-ds.js +106 -0
  26. package/dist/inject_mocha-BVf8v6El.js +38 -0
  27. package/dist/inject_mocha-Daf1Aj8M.d.ts +1 -0
  28. package/dist/inject_mocha.d.ts +1 -1
  29. package/dist/inject_mocha.js +21 -32
  30. package/dist/lib/agent_handler.d.ts +4 -1
  31. package/dist/lib/agent_handler.js +7 -24
  32. package/dist/lib/app.d.ts +5 -6
  33. package/dist/lib/app.js +12 -252
  34. package/dist/lib/app_handler.d.ts +5 -8
  35. package/dist/lib/app_handler.js +19 -54
  36. package/dist/lib/cluster.d.ts +5 -125
  37. package/dist/lib/cluster.js +5 -281
  38. package/dist/lib/context.js +1 -8
  39. package/dist/lib/format_options.d.ts +2 -2
  40. package/dist/lib/format_options.js +2 -63
  41. package/dist/lib/inject_context.js +20 -104
  42. package/dist/lib/mock_agent.js +1 -43
  43. package/dist/lib/mock_custom_loader.js +1 -33
  44. package/dist/lib/mock_http_server.js +1 -15
  45. package/dist/lib/mock_httpclient.d.ts +1 -39
  46. package/dist/lib/mock_httpclient.js +2 -108
  47. package/dist/lib/parallel/agent.d.ts +4 -23
  48. package/dist/lib/parallel/agent.js +6 -109
  49. package/dist/lib/parallel/app.d.ts +3 -2
  50. package/dist/lib/parallel/app.js +7 -97
  51. package/dist/lib/parallel/util.d.ts +1 -5
  52. package/dist/lib/parallel/util.js +2 -57
  53. package/dist/lib/restore.d.ts +1 -3
  54. package/dist/lib/restore.js +7 -14
  55. package/dist/lib/supertest.d.ts +1 -15
  56. package/dist/lib/supertest.js +3 -37
  57. package/dist/lib/types.d.ts +3 -76
  58. package/dist/lib/types.js +2 -0
  59. package/dist/lib/utils.js +1 -38
  60. package/dist/mock_agent-CxT7Q0_N.js +45 -0
  61. package/dist/mock_custom_loader-f_tHRojG.js +35 -0
  62. package/dist/mock_http_server-De0r07gr.js +17 -0
  63. package/dist/mock_httpclient-1EgQkMxi.d.ts +40 -0
  64. package/dist/mock_httpclient-B6UVI7GS.js +110 -0
  65. package/dist/register.d.ts +2 -0
  66. package/dist/register.js +22 -4
  67. package/dist/restore-BL0cE0KG.d.ts +4 -0
  68. package/dist/restore-CVQYXquh.js +16 -0
  69. package/dist/src-D22EjdGo.js +47 -0
  70. package/dist/supertest-BIds28yL.d.ts +16 -0
  71. package/dist/supertest-Cg412Los.js +39 -0
  72. package/dist/types-CPNMyF89.js +1 -0
  73. package/dist/types-CjZ-JeCo.d.ts +75 -0
  74. package/dist/util-1xYBaaoh.d.ts +6 -0
  75. package/dist/util-BpppqTXv.js +59 -0
  76. package/dist/utils-MhP_Krx1.js +40 -0
  77. package/package.json +7 -9
  78. package/dist/_virtual/rolldown_runtime.js +0 -7
@@ -1,26 +1,9 @@
1
- import { getEggOptions } from "./utils.js";
2
- import { createAgent } from "./parallel/agent.js";
3
- import { debuglog } from "node:util";
1
+ import "../utils-MhP_Krx1.js";
2
+ import "../format_options-LRnReKde.js";
3
+ import "../context-BIduDy1M.js";
4
+ import "../mock_custom_loader-f_tHRojG.js";
5
+ import "../util-BpppqTXv.js";
6
+ import "../agent-BKYkjoCx.js";
7
+ import { closeAgent, setupAgent } from "../agent_handler-DeUtoRVT.js";
4
8
 
5
- //#region src/lib/agent_handler.ts
6
- const debug = debuglog("egg/mock/lib/agent_handler");
7
- let agent;
8
- async function setupAgent() {
9
- debug("setupAgent call, env.ENABLE_MOCHA_PARALLEL: %s, process.env.AUTO_AGENT: %s, agent: %s", process.env.ENABLE_MOCHA_PARALLEL, process.env.AUTO_AGENT, !!agent);
10
- if (agent) {
11
- await agent.ready();
12
- return agent;
13
- }
14
- if (process.env.ENABLE_MOCHA_PARALLEL && process.env.AUTO_AGENT) {
15
- agent = createAgent(getEggOptions());
16
- await agent.ready();
17
- }
18
- return agent;
19
- }
20
- async function closeAgent() {
21
- debug("setupAgent call, agent: %s", !!agent);
22
- if (agent) await agent.close();
23
- }
24
-
25
- //#endregion
26
9
  export { closeAgent, setupAgent };
package/dist/lib/app.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { MockOptions } from "./types.js";
2
- import ApplicationUnittest from "../app/extend/application.js";
3
-
4
- //#region src/lib/app.d.ts
5
- declare function createApp(createOptions?: MockOptions): ApplicationUnittest;
6
- //#endregion
1
+ import "../mock_httpclient-1EgQkMxi.js";
2
+ import "../supertest-BIds28yL.js";
3
+ import "../types-CjZ-JeCo.js";
4
+ import "../application-BPpvw5dg.js";
5
+ import { createApp } from "../app-l47a-gqT.js";
7
6
  export { createApp };
package/dist/lib/app.js CHANGED
@@ -1,254 +1,14 @@
1
- import { createServer } from "./mock_http_server.js";
2
- import { getProperty, getSourceDirname, rimraf, sleep } from "./utils.js";
3
- import { formatOptions } from "./format_options.js";
4
- import { context } from "./context.js";
5
- import { setCustomLoader } from "./mock_custom_loader.js";
6
- import "../app/extend/application.js";
7
- import "../app/extend/agent.js";
8
- import { strict } from "node:assert";
9
- import path from "node:path";
10
- import { debuglog } from "node:util";
11
- import os from "node:os";
12
- import { importModule } from "@eggjs/utils";
13
- import { Base } from "sdk-base";
14
- import { detectPort } from "detect-port";
1
+ import "../mock_http_server-De0r07gr.js";
2
+ import "../utils-MhP_Krx1.js";
3
+ import "../supertest-Cg412Los.js";
4
+ import "../format_options-LRnReKde.js";
5
+ import "../context-BIduDy1M.js";
6
+ import "../mock_custom_loader-f_tHRojG.js";
7
+ import "../mock_agent-CxT7Q0_N.js";
8
+ import "../mock_httpclient-B6UVI7GS.js";
9
+ import "../types-CPNMyF89.js";
10
+ import "../application-LrKwuOKn.js";
11
+ import "../agent-DZ_fHoxJ.js";
12
+ import { createApp } from "../app-6Bn3F5Uw.js";
15
13
 
16
- //#region src/lib/app.ts
17
- const debug = debuglog("egg/mock/lib/app");
18
- const apps = /* @__PURE__ */ new Map();
19
- const APP_INIT = Symbol("appInit");
20
- const MESSENGER = Symbol("messenger");
21
- const MOCK_APP_METHOD = [
22
- "ready",
23
- "closed",
24
- "isClosed",
25
- "close",
26
- "_agent",
27
- "_app",
28
- "on",
29
- "once",
30
- "then"
31
- ];
32
- var MockApplicationWorker = class extends Base {
33
- _agent;
34
- _app;
35
- baseDir;
36
- [APP_INIT] = false;
37
- _initOnListeners;
38
- _initOnceListeners;
39
- constructor(options) {
40
- super({
41
- initMethod: "_init",
42
- ...options
43
- });
44
- this.baseDir = options.baseDir;
45
- this._initOnListeners = /* @__PURE__ */ new Set();
46
- this._initOnceListeners = /* @__PURE__ */ new Set();
47
- }
48
- async _init() {
49
- if (this.options.beforeInit) {
50
- await this.options.beforeInit(this);
51
- this.options.beforeInit = void 0;
52
- }
53
- if (this.options.clean !== false) {
54
- const logDir = path.join(this.options.baseDir, "logs");
55
- try {
56
- if (os.platform() === "win32") await sleep(1e3);
57
- await rimraf(logDir);
58
- } catch (err) {
59
- console.error(`remove log dir ${logDir} failed: ${err.stack}`);
60
- }
61
- const runDir = path.join(this.options.baseDir, "run");
62
- try {
63
- if (os.platform() === "win32") await sleep(1e3);
64
- await rimraf(runDir);
65
- } catch (err) {
66
- console.error(`remove run dir ${runDir} failed: ${err.stack}`);
67
- }
68
- }
69
- this.options.clusterPort = await detectPort();
70
- debug("[init] options: %o", this.options);
71
- const egg = await importModule(this.options.framework);
72
- strict(egg.Agent, `should export Agent class from framework ${this.options.framework}`);
73
- const Agent = egg.Agent;
74
- const agent = this._agent = new Agent({ ...this.options });
75
- debug("agent instantiate");
76
- await agent.ready();
77
- debug("agent ready");
78
- const app = this._app = new (bindMessenger(egg.Application, agent))({ ...this.options });
79
- app.agent = agent;
80
- Reflect.set(agent, "app", app);
81
- Object.assign(app.context, context);
82
- debug("app instantiate");
83
- this[APP_INIT] = true;
84
- debug("this[APP_INIT] = true");
85
- this.#bindEvent();
86
- debug("http server instantiate");
87
- createServer(app);
88
- await app.ready();
89
- setCustomLoader(app);
90
- const msg = {
91
- action: "egg-ready",
92
- data: this.options
93
- };
94
- app.messenger.onMessage(msg);
95
- agent.messenger.onMessage(msg);
96
- debug("app ready");
97
- }
98
- #bindEvent() {
99
- debug("bind cache events to app");
100
- for (const args of this._initOnListeners) {
101
- debug("on(%s), use cache and pass to app", args);
102
- this._app.on(args[0], args[1]);
103
- this.removeListener(args[0], args[1]);
104
- }
105
- for (const args of this._initOnceListeners) {
106
- debug("once(%s), use cache and pass to app", args);
107
- this._app.once(args[0], args[1]);
108
- this.removeListener(args[0], args[1]);
109
- }
110
- }
111
- on(...args) {
112
- if (this[APP_INIT]) {
113
- debug("on(%s), pass to app", args);
114
- this._app.on(args[0], args[1]);
115
- } else {
116
- debug("on(%s), cache it because app has not init", args);
117
- this._initOnListeners.add(args);
118
- super.on(args[0], args[1]);
119
- }
120
- return this;
121
- }
122
- once(...args) {
123
- if (this[APP_INIT]) {
124
- debug("once(%s), pass to app", args);
125
- this._app.once(args[0], args[1]);
126
- } else {
127
- debug("once(%s), cache it because app has not init", args);
128
- this._initOnceListeners.add(args);
129
- super.on(args[0], args[1]);
130
- }
131
- return this;
132
- }
133
- /**
134
- * close app
135
- */
136
- async _close() {
137
- const baseDir = this.baseDir;
138
- if (this._app) await this._app.close();
139
- else await sleep(200);
140
- if (this._agent) await this._agent.close();
141
- apps.delete(baseDir);
142
- debug("delete app cache %s, remain %s", baseDir, [...apps.keys()]);
143
- if (os.platform() === "win32") await sleep(1e3);
144
- }
145
- /**
146
- * @deprecated please use isClosed instead, keep compatible with old version
147
- */
148
- get closed() {
149
- return this.isClosed;
150
- }
151
- };
152
- function createApp(createOptions) {
153
- const options = formatOptions({
154
- ...createOptions,
155
- mode: "all-in-one-process"
156
- });
157
- debug("[createApp] options: %o", options);
158
- if (options.cache && apps.has(options.baseDir)) {
159
- const app = apps.get(options.baseDir);
160
- if (app && !app.isClosed) {
161
- debug("use cache app %s", options.baseDir);
162
- return app;
163
- }
164
- apps.delete(options.baseDir);
165
- }
166
- const appWorker = new MockApplicationWorker(options);
167
- const proxyApp = new Proxy(appWorker, {
168
- get(target, prop) {
169
- if (MOCK_APP_METHOD.includes(prop)) return getProperty(target, prop);
170
- if (!target[APP_INIT]) throw new Error(`can't get ${prop} before ready`);
171
- debug("proxy handler.get %s", prop);
172
- return target._app[prop];
173
- },
174
- set(target, prop, value) {
175
- if (MOCK_APP_METHOD.includes(prop)) return true;
176
- if (!target[APP_INIT]) throw new Error(`can't set ${prop} before ready`);
177
- debug("proxy handler.set %s", prop);
178
- target._app[prop] = value;
179
- return true;
180
- },
181
- defineProperty(target, prop, descriptor) {
182
- if (MOCK_APP_METHOD.includes(prop)) return true;
183
- if (!target[APP_INIT]) throw new Error(`can't defineProperty ${prop} before ready`);
184
- debug("proxy handler.defineProperty %s", prop);
185
- Object.defineProperty(target._app, prop, descriptor);
186
- return true;
187
- },
188
- deleteProperty(target, prop) {
189
- if (MOCK_APP_METHOD.includes(prop)) return true;
190
- if (!target[APP_INIT]) throw new Error(`can't delete ${prop} before ready`);
191
- debug("proxy handler.deleteProperty %s", prop);
192
- delete target._app[prop];
193
- return true;
194
- },
195
- getOwnPropertyDescriptor(target, prop) {
196
- if (MOCK_APP_METHOD.includes(prop)) return Object.getOwnPropertyDescriptor(target, prop);
197
- if (!target[APP_INIT]) throw new Error(`can't getOwnPropertyDescriptor ${prop} before ready`);
198
- debug("proxy handler.getOwnPropertyDescriptor %s", prop);
199
- return Object.getOwnPropertyDescriptor(target._app, prop);
200
- },
201
- getPrototypeOf(target) {
202
- if (!target[APP_INIT]) throw new Error("can't getPrototypeOf before ready");
203
- debug("proxy handler.getPrototypeOf %s");
204
- return Object.getPrototypeOf(target._app);
205
- }
206
- });
207
- apps.set(options.baseDir, proxyApp);
208
- return proxyApp;
209
- }
210
- function bindMessenger(ApplicationClass, agent) {
211
- const agentMessenger = agent.messenger;
212
- return class MessengerApplication extends ApplicationClass {
213
- [MESSENGER];
214
- constructor(options) {
215
- super(options);
216
- this.messenger.sendRandom = (action, data) => {
217
- this.messenger.sendToAgent(action, data);
218
- };
219
- agentMessenger.on("egg-ready", () => {
220
- agentMessenger.sendRandom = (action, data) => {
221
- agentMessenger.sendToApp(action, data);
222
- return agentMessenger;
223
- };
224
- });
225
- agentMessenger.send = new Proxy(agentMessenger.send, { apply: this._sendMessage.bind(this) });
226
- }
227
- _sendMessage(_target, _thisArg, [action, data, to]) {
228
- const appMessenger = this.messenger;
229
- setImmediate(() => {
230
- if (to === "app") appMessenger.onMessage({
231
- action,
232
- data
233
- });
234
- else agentMessenger.onMessage({
235
- action,
236
- data
237
- });
238
- });
239
- }
240
- get messenger() {
241
- return this[MESSENGER];
242
- }
243
- set messenger(m) {
244
- m.send = new Proxy(m.send, { apply: this._sendMessage.bind(this) });
245
- this[MESSENGER] = m;
246
- }
247
- get [Symbol.for("egg#eggPath")]() {
248
- return path.join(getSourceDirname(), "lib/tmp");
249
- }
250
- };
251
- }
252
-
253
- //#endregion
254
14
  export { createApp };
@@ -1,9 +1,6 @@
1
- import ApplicationUnittest from "../app/extend/application.js";
2
-
3
- //#region src/lib/app_handler.d.ts
4
- declare function setupApp(): ApplicationUnittest;
5
- declare function setGetAppCallback(cb: (suite: unknown, test?: unknown) => any): void;
6
- declare function getApp(suite?: unknown, test?: unknown): Promise<any>;
7
- declare function getBootstrapApp(): ApplicationUnittest;
8
- //#endregion
1
+ import "../mock_httpclient-1EgQkMxi.js";
2
+ import "../supertest-BIds28yL.js";
3
+ import "../types-CjZ-JeCo.js";
4
+ import "../application-BPpvw5dg.js";
5
+ import { getApp, getBootstrapApp, setGetAppCallback, setupApp } from "../app_handler-Gp5J9X-v.js";
9
6
  export { getApp, getBootstrapApp, setGetAppCallback, setupApp };
@@ -1,56 +1,21 @@
1
- import { getEggOptions } from "./utils.js";
2
- import "../app/extend/application.js";
3
- import { createApp as createApp$1 } from "./app.js";
4
- import { restore } from "./restore.js";
5
- import { createApp } from "./parallel/app.js";
6
- import { setupAgent } from "./agent_handler.js";
7
- import { debuglog } from "node:util";
1
+ import "../mock_http_server-De0r07gr.js";
2
+ import "../utils-MhP_Krx1.js";
3
+ import "../supertest-Cg412Los.js";
4
+ import "../format_options-LRnReKde.js";
5
+ import "../cluster-CA_hr9eV.js";
6
+ import "../context-BIduDy1M.js";
7
+ import "../mock_custom_loader-f_tHRojG.js";
8
+ import "../mock_agent-CxT7Q0_N.js";
9
+ import "../mock_httpclient-B6UVI7GS.js";
10
+ import "../types-CPNMyF89.js";
11
+ import "../application-LrKwuOKn.js";
12
+ import "../agent-DZ_fHoxJ.js";
13
+ import "../app-6Bn3F5Uw.js";
14
+ import "../restore-CVQYXquh.js";
15
+ import "../util-BpppqTXv.js";
16
+ import "../app-CoypamK1.js";
17
+ import "../agent-BKYkjoCx.js";
18
+ import "../agent_handler-DeUtoRVT.js";
19
+ import { getApp, getBootstrapApp, setGetAppCallback, setupApp } from "../app_handler-CkiK6fyC.js";
8
20
 
9
- //#region src/lib/app_handler.ts
10
- const debug = debuglog("egg/mock/lib/app_handler");
11
- globalThis.__eggMockAppInstance = null;
12
- function setupApp() {
13
- let app = globalThis.__eggMockAppInstance;
14
- if (app) {
15
- debug("return exists app");
16
- return app;
17
- }
18
- const options = getEggOptions();
19
- debug("env.ENABLE_MOCHA_PARALLEL: %s, process.env.AUTO_AGENT: %s", process.env.ENABLE_MOCHA_PARALLEL, process.env.AUTO_AGENT);
20
- if (process.env.ENABLE_MOCHA_PARALLEL && process.env.AUTO_AGENT) {
21
- app = createApp({
22
- ...options,
23
- beforeInit: async (parallelApp) => {
24
- const agent = await setupAgent();
25
- parallelApp.options.clusterPort = agent.options.clusterPort;
26
- debug("mockParallelApp beforeInit get clusterPort: %s", parallelApp.options.clusterPort);
27
- }
28
- });
29
- debug("mockParallelApp app: %s", !!app);
30
- } else {
31
- app = createApp$1(options);
32
- if (typeof beforeAll === "function") beforeAll(() => app.ready());
33
- if (typeof afterEach === "function") {
34
- afterEach(() => app.backgroundTasksFinished());
35
- afterEach(restore);
36
- }
37
- }
38
- globalThis.__eggMockAppInstance = app;
39
- return app;
40
- }
41
- let getAppCallback;
42
- function setGetAppCallback(cb) {
43
- getAppCallback = cb;
44
- }
45
- async function getApp(suite, test) {
46
- if (getAppCallback) return getAppCallback(suite, test);
47
- const app = globalThis.__eggMockAppInstance;
48
- if (app) await app.ready();
49
- return app;
50
- }
51
- function getBootstrapApp() {
52
- return globalThis.__eggMockAppInstance;
53
- }
54
-
55
- //#endregion
56
21
  export { getApp, getBootstrapApp, setGetAppCallback, setupApp };
@@ -1,126 +1,6 @@
1
- import { EggTestRequest } from "./supertest.js";
2
- import { MockClusterApplicationOptions, MockClusterOptions } from "./types.js";
3
- import ApplicationUnittest from "../app/extend/application.js";
4
- import { Coffee } from "coffee";
5
-
6
- //#region src/lib/cluster.d.ts
7
- declare global {
8
- var eggMockMasterPort: number;
9
- }
10
- /**
11
- * A cluster version of egg.Application, you can test with supertest
12
- * @example
13
- * ```js
14
- * const mm = require('mm');
15
- * const request = require('supertest');
16
- *
17
- * describe('ClusterApplication', () => {
18
- * let app;
19
- * before(function (done) {
20
- * app = mm.cluster({ baseDir });
21
- * app.ready(done);
22
- * });
23
- *
24
- * after(function () {
25
- * app.close();
26
- * });
27
- *
28
- * it('should 200', function (done) {
29
- * request(app.callback())
30
- * .get('/')
31
- * .expect(200, done);
32
- * });
33
- * });
34
- */
35
- declare class ClusterApplication extends Coffee {
36
- [key: string | symbol]: any;
37
- options: MockClusterApplicationOptions;
38
- port: number;
39
- baseDir: string;
40
- closed: boolean;
41
- private _address;
42
- /**
43
- * @class
44
- * @param {Object} options
45
- * - {String} baseDir - The directory of the application
46
- * - {Object} plugins - Custom you plugins
47
- * - {String} framework - The directory of the egg framework
48
- * - {Boolean} [cache=true] - Cache application based on baseDir
49
- * - {Boolean} [coverage=true] - Switch on process coverage, but it'll be slower
50
- * - {Boolean} [clean=true] - Remove $baseDir/logs
51
- * - {Object} [opt] - opt pass to coffee, such as { execArgv: ['--debug'] }
52
- * ```
53
- */
54
- constructor(options: MockClusterApplicationOptions);
55
- /**
56
- * the process that forked
57
- * @member {ChildProcess}
58
- */
59
- get process(): any;
60
- /**
61
- * Compatible API for supertest
62
- */
63
- callback(): this;
64
- /**
65
- * Compatible API for supertest
66
- * @member {String} url
67
- * @private
68
- */
69
- get url(): string;
70
- /**
71
- * Compatible API for supertest
72
- */
73
- address(): {
74
- port: number;
75
- address: string | undefined;
76
- };
77
- /**
78
- * Compatible API for supertest
79
- */
80
- listen(): this;
81
- /**
82
- * kill the process
83
- */
84
- close(): Promise<void>;
85
- get isClosed(): boolean;
86
- get router(): {
87
- pathFor(url: string): any;
88
- };
89
- /**
90
- * get app[property] value in app worker
91
- */
92
- getAppInstanceProperty(property: string): any;
93
- /**
94
- * collection logger message, then can be use on `expectLog()`
95
- * it's different from `app.expectLog()`, only support string params.
96
- *
97
- * @param {String} [logger] - logger instance name, default is `logger`
98
- * @function ClusterApplication#expectLog
99
- */
100
- mockLog(logger?: string): void;
101
- /**
102
- * expect str in the logger
103
- * it's different from `app.expectLog()`, only support string params.
104
- *
105
- * @param {String} str - test str
106
- * @param {String} [logger] - logger instance name, default is `logger`
107
- * @function ClusterApplication#expectLog
108
- */
109
- expectLog(str: string, logger?: string): void;
110
- /**
111
- * not expect str in the logger
112
- * it's different from `app.notExpectLog()`, only support string params.
113
- *
114
- * @param {String} str - test str
115
- * @param {String} [logger] - logger instance name, default is `logger`
116
- * @function ClusterApplication#notExpectLog
117
- */
118
- notExpectLog(str: string, logger?: string): void;
119
- httpRequest(): EggTestRequest;
120
- _callFunctionOnAppWorker(method: string, args?: any[], property?: any, needResult?: boolean): any;
121
- }
122
- type MockClusterApplication = ClusterApplication & ApplicationUnittest;
123
- declare function createCluster(initOptions?: MockClusterOptions): MockClusterApplication;
124
- declare function restore(): Promise<void>;
125
- //#endregion
1
+ import "../mock_httpclient-1EgQkMxi.js";
2
+ import "../supertest-BIds28yL.js";
3
+ import "../types-CjZ-JeCo.js";
4
+ import "../application-BPpvw5dg.js";
5
+ import { ClusterApplication, MockClusterApplication, createCluster, restore } from "../cluster-RTfUwmUd.js";
126
6
  export { ClusterApplication, MockClusterApplication, createCluster, restore };