print warning for successful tests only
This commit is contained in:
parent
8bb4996ea8
commit
fb810428ad
|
|
@ -134,8 +134,11 @@ module.exports.describe = ({testRunner, product, playwrightPath}) => {
|
|||
});
|
||||
|
||||
afterEach(async (state, test) => {
|
||||
if (state.browser.contexts().length !== 0)
|
||||
console.warn(`\nWARNING: test "${test.fullName}" (${test.location.fileName}:${test.location.lineNumber}) did not close all created contexts!\n`);
|
||||
if (state.browser.contexts().length !== 0) {
|
||||
if (test.result === 'ok')
|
||||
console.warn(`\nWARNING: test "${test.fullName}" (${test.location.fileName}:${test.location.lineNumber}) did not close all created contexts!\n`);
|
||||
await Promise.all(state.browser.contexts().map(context => context.close()));
|
||||
}
|
||||
await state.tearDown();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue