Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
default: mock.EggMock;
app: (option?: MidwayApplicationOptions) => MidwayMockApplication;
cluster: (option?: MidwayApplicationOptions) => MidwayMockApplication;
// [prop: string]: any
}
/**
* 只初始化app级别的container
* agent相关的逻辑使用mm2.app
* @param options 参数
*/
function mockContainer(options: MidwayApplicationOptions): MockContainer {
return new MockContainer(options);
}
const defaultFramework: string = resolveModule('midway') || resolveModule('midway-mirror');
export const mm = Object.assign({}, mock, {
container: mockContainer,
}) as MidwayMock;
mm.app = (options): MidwayMockApplication => {
if (process.env.MIDWAY_BASE_DIR && !options.baseDir) { options.baseDir = process.env.MIDWAY_BASE_DIR; }
if (process.env.MIDWAY_FRAMEWORK_PATH && !options.framework) { options.framework = process.env.MIDWAY_FRAMEWORK_PATH; }
// @ts-ignore
return mock.app(Object.assign({
framework: options.framework || defaultFramework,
typescript: !!require.extensions['.ts'],
}, options));
};
mm.cluster = (options) => {