fix(core): change proxied agent methods to native (#654)

This commit is contained in:
Junyi 2022-07-19 22:51:27 +08:00 committed by GitHub
parent a60759b2eb
commit b215f92ecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 10 deletions

View File

@ -98,7 +98,6 @@ class DatabaseVersion {
return false;
}
const [result] = (await this.db.sequelize.query(dialects[dialect].sql)) as any;
console.log(`db version: ${dialects[dialect].get(result?.[0]?.version)}`);
return semver.satisfies(dialects[dialect].get(result?.[0]?.version), versions[dialect]);
}
}

View File

@ -121,9 +121,7 @@ export class MockServer extends Application {
return proxy;
};
}
return (...args: any[]) => {
return agent[method](...args);
};
return agent[method];
},
});
return proxy as any;

View File

@ -1,11 +1,11 @@
export function requireModule(module: any) {
if (typeof module === 'string') {
module = require(module);
export function requireModule(m: any) {
if (typeof m === 'string') {
m = require(m);
}
if (typeof module !== 'object') {
return module;
if (typeof m !== 'object') {
return m;
}
return module.__esModule ? module.default : module;
return m.__esModule ? m.default : m;
}
export default requireModule;