|
|
@@ -9,6 +9,7 @@ import { SqljsConnectionOptions } from 'typeorm/driver/sqljs/SqljsConnectionOpti
|
|
|
import { populateForTesting, PopulateOptions } from '../mock-data/populate-for-testing';
|
|
|
import { preBootstrapConfig } from '../src/bootstrap';
|
|
|
import { Mutable } from '../src/common/types/common-types';
|
|
|
+import { DefaultLogger } from '../src/config/logger/default-logger';
|
|
|
import { Logger } from '../src/config/logger/vendure-logger';
|
|
|
import { VendureConfig } from '../src/config/vendure-config';
|
|
|
|
|
|
@@ -36,9 +37,6 @@ export class TestServer {
|
|
|
): Promise<void> {
|
|
|
setTestEnvironment();
|
|
|
const testingConfig = { ...testConfig, ...customConfig };
|
|
|
- if (options.logging) {
|
|
|
- (testingConfig.dbConnectionOptions as Mutable<ConnectionOptions>).logging = true;
|
|
|
- }
|
|
|
const dbFilePath = this.getDbFilePath();
|
|
|
(testingConfig.dbConnectionOptions as Mutable<SqljsConnectionOptions>).location = dbFilePath;
|
|
|
if (!fs.existsSync(dbFilePath)) {
|
|
|
@@ -112,8 +110,10 @@ export class TestServer {
|
|
|
userConfig: Partial<VendureConfig>,
|
|
|
): Promise<[INestApplication, INestMicroservice | undefined]> {
|
|
|
const config = await preBootstrapConfig(userConfig);
|
|
|
+ Logger.useLogger(config.logger);
|
|
|
const appModule = await import('../src/app.module');
|
|
|
try {
|
|
|
+ DefaultLogger.hideNestBoostrapLogs();
|
|
|
const app = await NestFactory.create(appModule.AppModule, { cors: config.cors, logger: false });
|
|
|
let worker: INestMicroservice | undefined;
|
|
|
await app.listen(config.port);
|
|
|
@@ -126,6 +126,7 @@ export class TestServer {
|
|
|
});
|
|
|
await worker.listenAsync();
|
|
|
}
|
|
|
+ DefaultLogger.restoreOriginalLogLevel();
|
|
|
return [app, worker];
|
|
|
} catch (e) {
|
|
|
console.log(e);
|