@estruyf/github-actions-reporter
Version:
GitHub Actions reporter for Playwright
21 lines (20 loc) • 550 B
JavaScript
export const getTestsPerFile = (suite) => {
// Get all the test files
const files = suite
.allTests()
.map((test) => test.location.file)
.reduce((acc, curr) => {
if (!acc.includes(curr)) {
acc.push(curr);
}
return acc;
}, []);
// Get all the tests per file
const tests = files.reduce((acc, curr) => {
acc[curr] = suite.allTests().filter((test) => {
return test.location.file === curr;
});
return acc;
}, {});
return tests;
};