smoke - more logging

This commit is contained in:
Benjamin Pasero
2021-12-08 15:23:22 +01:00
parent 5e54e75763
commit 18cba4882d
10 changed files with 57 additions and 60 deletions

View File

@@ -26,23 +26,20 @@ export function installCommonTestHandlers(args: minimist.ParsedArgs, optionsTran
export function installCommonBeforeHandlers(args: minimist.ParsedArgs, optionsTransform?: (opts: ApplicationOptions) => Promise<ApplicationOptions>) {
before(async function () {
const testTitle = this.currentTest?.title;
this.app = await startApp(args, this.defaultOptions, async opts => {
opts.testTitle = testTitle;
if (optionsTransform) {
opts = await optionsTransform(opts);
}
return opts;
});
this.app = await startApp(args, this.defaultOptions, optionsTransform);
});
installCommonBeforeEachHandler();
}
export function installCommonBeforeEachHandler() {
beforeEach(async function () {
if (this.app) {
await this.app.startTracing(this.currentTest?.title);
}
const testTitle = this.currentTest?.title;
this.defaultOptions.logger.log('');
this.defaultOptions.logger.log(`>>> Test start: ${testTitle} <<<`);
this.defaultOptions.logger.log('');
await this.app?.startTracing(testTitle);
});
}
@@ -58,10 +55,6 @@ export async function startApp(args: minimist.ParsedArgs, options: ApplicationOp
await app.start();
if (options.testTitle) {
app.logger.log('Test start:', options.testTitle);
}
return app;
}
@@ -98,9 +91,7 @@ export function installCommonAfterHandlers(opts: minimist.ParsedArgs, appFn?: ()
});
afterEach(async function () {
if (this.app) {
await this.app.stopTracing(this.currentTest?.title, this.currentTest?.state === 'failed');
}
await this.app?.stopTracing(this.currentTest?.title, this.currentTest?.state === 'failed');
});
}