Revert "docs: show browser test stats in the readme (#24)"
This reverts test stats from the README.md The stats now leave in a designated status page.
This commit is contained in:
parent
2b40361b0a
commit
43836c9178
|
|
@ -1,9 +1,3 @@
|
||||||
# Browser Test Stats
|
|
||||||
<!-- GEN:test-stats -->
|
|
||||||
|Firefox|Chromium|WebKit|all|
|
|
||||||
|---|---|---|---|
|
|
||||||
|508/632|683/690|325/635|309/632|
|
|
||||||
<!-- GEN:stop -->
|
|
||||||
|
|
||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
const path = require('path');
|
|
||||||
const {TestRunner} = require('../utils/testrunner/');
|
|
||||||
const utils = require('./utils');
|
|
||||||
const {addTests} = require('./playwright.spec.js');
|
|
||||||
const firefoxTests = testsForProduct('Firefox');
|
|
||||||
const chromiumTests = testsForProduct('Chromium');
|
|
||||||
const webkitTests = testsForProduct('WebKit');
|
|
||||||
const goalSuite = intersectSets(firefoxTests.all, chromiumTests.all, webkitTests.all);
|
|
||||||
const skippedSuite = intersectSets(goalSuite, joinSets(firefoxTests.skipped, chromiumTests.skipped, webkitTests.skipped));
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
firefox: {
|
|
||||||
total: firefoxTests.all.size,
|
|
||||||
skipped: firefoxTests.skipped.size,
|
|
||||||
},
|
|
||||||
chromium: {
|
|
||||||
total: chromiumTests.all.size,
|
|
||||||
skipped: chromiumTests.skipped.size,
|
|
||||||
},
|
|
||||||
webkit: {
|
|
||||||
total: webkitTests.all.size,
|
|
||||||
skipped: webkitTests.skipped.size,
|
|
||||||
},
|
|
||||||
all: {
|
|
||||||
total: goalSuite.size,
|
|
||||||
skipped: skippedSuite.size,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} product
|
|
||||||
*/
|
|
||||||
function testsForProduct(product) {
|
|
||||||
const testRunner = new TestRunner();
|
|
||||||
addTests({
|
|
||||||
product,
|
|
||||||
playwrightPath: path.join(utils.projectRoot(), `${product.toLowerCase()}.js`),
|
|
||||||
testRunner
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
all: new Set(testRunner.tests().map(test => test.fullName)),
|
|
||||||
skipped: new Set(testRunner.tests().filter(test => test.declaredMode === 'skip').map(test => test.fullName))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {...Set} sets
|
|
||||||
*/
|
|
||||||
function intersectSets(...sets) {
|
|
||||||
if (!sets.length)
|
|
||||||
return new Set();
|
|
||||||
const intersect = new Set();
|
|
||||||
const [first, ...rest] = sets;
|
|
||||||
outer: for (const item of first) {
|
|
||||||
for (const set of rest)
|
|
||||||
if (!set.has(item))
|
|
||||||
continue outer;
|
|
||||||
intersect.add(item);
|
|
||||||
}
|
|
||||||
return intersect;
|
|
||||||
}
|
|
||||||
|
|
||||||
function joinSets(...sets) {
|
|
||||||
const joined = new Set();
|
|
||||||
for (const set of sets)
|
|
||||||
for (const item of set)
|
|
||||||
joined.add(item);
|
|
||||||
return joined;
|
|
||||||
}
|
|
||||||
|
|
@ -70,8 +70,6 @@ module.exports.runCommands = function(sources, version) {
|
||||||
newText = isReleaseVersion ? '' : command.originalText;
|
newText = isReleaseVersion ? '' : command.originalText;
|
||||||
else if (command.name === 'toc')
|
else if (command.name === 'toc')
|
||||||
newText = generateTableOfContents(command.source.text().substring(command.to));
|
newText = generateTableOfContents(command.source.text().substring(command.to));
|
||||||
else if (command.name === 'test-stats')
|
|
||||||
newText = generateTestStats();
|
|
||||||
if (newText === null)
|
if (newText === null)
|
||||||
messages.push(Message.error(`Unknown command 'gen:${command.name}'`));
|
messages.push(Message.error(`Unknown command 'gen:${command.name}'`));
|
||||||
else if (applyCommand(command, newText))
|
else if (applyCommand(command, newText))
|
||||||
|
|
@ -93,19 +91,6 @@ function applyCommand(command, editText) {
|
||||||
return command.source.setText(newText);
|
return command.source.setText(newText);
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateTestStats() {
|
|
||||||
const stats = require('../../../test/stats');
|
|
||||||
return `
|
|
||||||
|Firefox|Chromium|WebKit|all|
|
|
||||||
|---|---|---|---|
|
|
||||||
|${s('firefox')}|${s('chromium')}|${s('webkit')}|${s('all')}|
|
|
||||||
`;
|
|
||||||
function s(product) {
|
|
||||||
const {total, skipped} = stats[product];
|
|
||||||
return `${total-skipped}/${total}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function generateTableOfContents(mdText) {
|
function generateTableOfContents(mdText) {
|
||||||
const ids = new Set();
|
const ids = new Set();
|
||||||
const titles = [];
|
const titles = [];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue