-
Notifications
You must be signed in to change notification settings - Fork 665
Expand file tree
/
Copy pathmodules.js
More file actions
31 lines (27 loc) · 1.05 KB
/
Copy pathmodules.js
File metadata and controls
31 lines (27 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// QUnit module names, discovered from the test sources so the Playwright run
// reports one test per module without having to load a browser first.
//
// A module listed here that does not run shows up as skipped rather than
// silently passing, which is what makes a browser dropping a whole backend
// visible.
const fs = require('fs');
const path = require('path');
const TEST_ROOT = path.join(__dirname, '..');
const SEARCHED = ['features', 'internal', 'issues'];
function walk(dir) {
return fs.readdirSync(dir, { withFileTypes: true }).flatMap(entry => {
const full = path.join(dir, entry.name);
if (entry.isDirectory()) return walk(full);
return entry.isFile() && entry.name.endsWith('.js') ? [full] : [];
});
}
const names = new Set();
for (const folder of SEARCHED) {
for (const file of walk(path.join(TEST_ROOT, folder))) {
const source = fs.readFileSync(file, 'utf8');
for (const match of source.matchAll(/^\s*describe\(\s*(['"`])([^'"`]+)\1/gm)) {
names.add(match[2]);
}
}
}
module.exports = { MODULES: [...names].sort() };