mirror of
https://github.com/microsoft/playwright.git
synced 2024-09-21 09:27:30 +03: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
82
test/test.js
82
test/test.js
@ -73,49 +73,49 @@ beforeEach(async({server, httpsServer}) => {
|
||||
httpsServer.reset();
|
||||
});
|
||||
|
||||
(async() => {
|
||||
if (process.env.BROWSER === 'firefox') {
|
||||
await describe('Firefox', () => {
|
||||
require('./playwright.spec.js').addTests({
|
||||
product: 'Firefox',
|
||||
playwrightPath: path.join(utils.projectRoot(), 'firefox.js'),
|
||||
testRunner,
|
||||
});
|
||||
if (process.env.BROWSER === 'firefox') {
|
||||
describe('Firefox', () => {
|
||||
require('./playwright.spec.js').addTests({
|
||||
product: 'Firefox',
|
||||
playwrightPath: path.join(utils.projectRoot(), 'firefox.js'),
|
||||
testRunner,
|
||||
});
|
||||
} else if (process.env.BROWSER === 'webkit') {
|
||||
await describe('WebKit', () => {
|
||||
require('./playwright.spec.js').addTests({
|
||||
product: 'WebKit',
|
||||
playwrightPath: path.join(utils.projectRoot(), 'webkit.js'),
|
||||
testRunner,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
await describe('Chromium', () => {
|
||||
require('./playwright.spec.js').addTests({
|
||||
product: 'Chromium',
|
||||
playwrightPath: path.join(utils.projectRoot(), 'chromium.js'),
|
||||
testRunner,
|
||||
});
|
||||
if (process.env.COVERAGE)
|
||||
utils.recordAPICoverage(testRunner, require('../lib/api').Chromium, require('../lib/chromium/events').Events);
|
||||
});
|
||||
}
|
||||
|
||||
if (process.env.CI && testRunner.hasFocusedTestsOrSuites()) {
|
||||
console.error('ERROR: "focused" tests/suites are prohibitted on bots. Remove any "fit"/"fdescribe" declarations.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
new Reporter(testRunner, {
|
||||
verbose: process.argv.includes('--verbose'),
|
||||
summary: !process.argv.includes('--verbose'),
|
||||
projectFolder: utils.projectRoot(),
|
||||
showSlowTests: process.env.CI ? 5 : 0,
|
||||
});
|
||||
} else if (process.env.BROWSER === 'webkit') {
|
||||
describe('WebKit', () => {
|
||||
require('./playwright.spec.js').addTests({
|
||||
product: 'WebKit',
|
||||
playwrightPath: path.join(utils.projectRoot(), 'webkit.js'),
|
||||
testRunner,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
describe('Chromium', () => {
|
||||
require('./playwright.spec.js').addTests({
|
||||
product: 'Chromium',
|
||||
playwrightPath: path.join(utils.projectRoot(), 'chromium.js'),
|
||||
testRunner,
|
||||
});
|
||||
if (process.env.COVERAGE)
|
||||
utils.recordAPICoverage(testRunner, require('../lib/api').Chromium, require('../lib/chromium/events').Events);
|
||||
});
|
||||
}
|
||||
|
||||
// await utils.initializeFlakinessDashboardIfNeeded(testRunner);
|
||||
const result = await testRunner.run();
|
||||
if (process.env.CI && testRunner.hasFocusedTestsOrSuites()) {
|
||||
console.error('ERROR: "focused" tests/suites are prohibitted on bots. Remove any "fit"/"fdescribe" declarations.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
new Reporter(testRunner, {
|
||||
verbose: process.argv.includes('--verbose'),
|
||||
summary: !process.argv.includes('--verbose'),
|
||||
projectFolder: utils.projectRoot(),
|
||||
showSlowTests: process.env.CI ? 5 : 0,
|
||||
showSkippedTests: 10,
|
||||
});
|
||||
|
||||
// await utils.initializeFlakinessDashboardIfNeeded(testRunner);
|
||||
testRunner.run().then(result => {
|
||||
process.exit(result.terminationError ? 130 : 0);
|
||||
})();
|
||||
});
|
||||
|
||||
|
@ -25,12 +25,14 @@ class Reporter {
|
||||
const {
|
||||
projectFolder = null,
|
||||
showSlowTests = 3,
|
||||
showSkippedTests = Infinity,
|
||||
verbose = false,
|
||||
summary = true,
|
||||
} = options;
|
||||
this._runner = runner;
|
||||
this._projectFolder = projectFolder;
|
||||
this._showSlowTests = showSlowTests;
|
||||
this._showSkippedTests = showSkippedTests;
|
||||
this._verbose = verbose;
|
||||
this._summary = summary;
|
||||
this._testCounter = 0;
|
||||
@ -125,12 +127,16 @@ class Reporter {
|
||||
}
|
||||
|
||||
const skippedTests = this._runner.skippedTests();
|
||||
if (this._summary && skippedTests.length > 0) {
|
||||
console.log('\nSkipped:');
|
||||
for (let i = 0; i < skippedTests.length; ++i) {
|
||||
const test = skippedTests[i];
|
||||
console.log(`${i + 1}) ${test.fullName} (${formatTestLocation(test)})`);
|
||||
console.log(` ${YELLOW_COLOR}Temporary disabled with xit${RESET_COLOR}`);
|
||||
if (this._showSkippedTests && this._summary && skippedTests.length) {
|
||||
if (skippedTests.length > 0) {
|
||||
console.log('\nSkipped:');
|
||||
skippedTests.slice(0, this._showSkippedTests).forEach((test, index) => {
|
||||
console.log(`${index + 1}) ${test.fullName} (${formatTestLocation(test)})`);
|
||||
});
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
async _addSuite(mode, comment, name, callback) {
|
||||
_addSuite(mode, comment, name, callback) {
|
||||
const oldSuite = this._currentSuite;
|
||||
const suite = new Suite(this._currentSuite, name, mode, comment);
|
||||
this._currentSuite.children.push(suite);
|
||||
this._currentSuite = suite;
|
||||
const result = callback();
|
||||
if (result && (typeof result.then === 'function'))
|
||||
await result;
|
||||
this._currentSuite = oldSuite;
|
||||
this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user