mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(testrunner): show maximum 10 skipped tests in test report
This is to save some terminal screen real estate. Drive-by: remove async test suites from test runner.
This commit is contained in:
parent
9afd35d3a1
commit
44b39bad33
12
test/test.js
12
test/test.js
@ -73,9 +73,8 @@ beforeEach(async({server, httpsServer}) => {
|
|||||||
httpsServer.reset();
|
httpsServer.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
(async() => {
|
|
||||||
if (process.env.BROWSER === 'firefox') {
|
if (process.env.BROWSER === 'firefox') {
|
||||||
await describe('Firefox', () => {
|
describe('Firefox', () => {
|
||||||
require('./playwright.spec.js').addTests({
|
require('./playwright.spec.js').addTests({
|
||||||
product: 'Firefox',
|
product: 'Firefox',
|
||||||
playwrightPath: path.join(utils.projectRoot(), 'firefox.js'),
|
playwrightPath: path.join(utils.projectRoot(), 'firefox.js'),
|
||||||
@ -83,7 +82,7 @@ beforeEach(async({server, httpsServer}) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else if (process.env.BROWSER === 'webkit') {
|
} else if (process.env.BROWSER === 'webkit') {
|
||||||
await describe('WebKit', () => {
|
describe('WebKit', () => {
|
||||||
require('./playwright.spec.js').addTests({
|
require('./playwright.spec.js').addTests({
|
||||||
product: 'WebKit',
|
product: 'WebKit',
|
||||||
playwrightPath: path.join(utils.projectRoot(), 'webkit.js'),
|
playwrightPath: path.join(utils.projectRoot(), 'webkit.js'),
|
||||||
@ -91,7 +90,7 @@ beforeEach(async({server, httpsServer}) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await describe('Chromium', () => {
|
describe('Chromium', () => {
|
||||||
require('./playwright.spec.js').addTests({
|
require('./playwright.spec.js').addTests({
|
||||||
product: 'Chromium',
|
product: 'Chromium',
|
||||||
playwrightPath: path.join(utils.projectRoot(), 'chromium.js'),
|
playwrightPath: path.join(utils.projectRoot(), 'chromium.js'),
|
||||||
@ -112,10 +111,11 @@ beforeEach(async({server, httpsServer}) => {
|
|||||||
summary: !process.argv.includes('--verbose'),
|
summary: !process.argv.includes('--verbose'),
|
||||||
projectFolder: utils.projectRoot(),
|
projectFolder: utils.projectRoot(),
|
||||||
showSlowTests: process.env.CI ? 5 : 0,
|
showSlowTests: process.env.CI ? 5 : 0,
|
||||||
|
showSkippedTests: 10,
|
||||||
});
|
});
|
||||||
|
|
||||||
// await utils.initializeFlakinessDashboardIfNeeded(testRunner);
|
// await utils.initializeFlakinessDashboardIfNeeded(testRunner);
|
||||||
const result = await testRunner.run();
|
testRunner.run().then(result => {
|
||||||
process.exit(result.terminationError ? 130 : 0);
|
process.exit(result.terminationError ? 130 : 0);
|
||||||
})();
|
});
|
||||||
|
|
||||||
|
@ -25,12 +25,14 @@ class Reporter {
|
|||||||
const {
|
const {
|
||||||
projectFolder = null,
|
projectFolder = null,
|
||||||
showSlowTests = 3,
|
showSlowTests = 3,
|
||||||
|
showSkippedTests = Infinity,
|
||||||
verbose = false,
|
verbose = false,
|
||||||
summary = true,
|
summary = true,
|
||||||
} = options;
|
} = options;
|
||||||
this._runner = runner;
|
this._runner = runner;
|
||||||
this._projectFolder = projectFolder;
|
this._projectFolder = projectFolder;
|
||||||
this._showSlowTests = showSlowTests;
|
this._showSlowTests = showSlowTests;
|
||||||
|
this._showSkippedTests = showSkippedTests;
|
||||||
this._verbose = verbose;
|
this._verbose = verbose;
|
||||||
this._summary = summary;
|
this._summary = summary;
|
||||||
this._testCounter = 0;
|
this._testCounter = 0;
|
||||||
@ -125,12 +127,16 @@ class Reporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const skippedTests = this._runner.skippedTests();
|
const skippedTests = this._runner.skippedTests();
|
||||||
if (this._summary && skippedTests.length > 0) {
|
if (this._showSkippedTests && this._summary && skippedTests.length) {
|
||||||
|
if (skippedTests.length > 0) {
|
||||||
console.log('\nSkipped:');
|
console.log('\nSkipped:');
|
||||||
for (let i = 0; i < skippedTests.length; ++i) {
|
skippedTests.slice(0, this._showSkippedTests).forEach((test, index) => {
|
||||||
const test = skippedTests[i];
|
console.log(`${index + 1}) ${test.fullName} (${formatTestLocation(test)})`);
|
||||||
console.log(`${i + 1}) ${test.fullName} (${formatTestLocation(test)})`);
|
});
|
||||||
console.log(` ${YELLOW_COLOR}Temporary disabled with xit${RESET_COLOR}`);
|
}
|
||||||
|
if (this._showSkippedTests < skippedTests.length) {
|
||||||
|
console.log('');
|
||||||
|
console.log(`... and ${YELLOW_COLOR}${skippedTests.length - this._showSkippedTests}${RESET_COLOR} more skipped tests ...`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,14 +345,12 @@ class TestRunner extends EventEmitter {
|
|||||||
this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus;
|
this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
async _addSuite(mode, comment, name, callback) {
|
_addSuite(mode, comment, name, callback) {
|
||||||
const oldSuite = this._currentSuite;
|
const oldSuite = this._currentSuite;
|
||||||
const suite = new Suite(this._currentSuite, name, mode, comment);
|
const suite = new Suite(this._currentSuite, name, mode, comment);
|
||||||
this._currentSuite.children.push(suite);
|
this._currentSuite.children.push(suite);
|
||||||
this._currentSuite = suite;
|
this._currentSuite = suite;
|
||||||
const result = callback();
|
const result = callback();
|
||||||
if (result && (typeof result.then === 'function'))
|
|
||||||
await result;
|
|
||||||
this._currentSuite = oldSuite;
|
this._currentSuite = oldSuite;
|
||||||
this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus;
|
this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user