mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
tests: Use map+reduce to improve readability
This commit is contained in:
parent
a8e77126e8
commit
d69345bb4e
1 changed files with 4 additions and 9 deletions
|
@ -57,19 +57,14 @@ const getPluginTests = async (callback) => {
|
||||||
const moduleDir = 'node_modules/';
|
const moduleDir = 'node_modules/';
|
||||||
const specPath = '/static/tests/frontend/specs/';
|
const specPath = '/static/tests/frontend/specs/';
|
||||||
const staticDir = '/static/plugins/';
|
const staticDir = '/static/plugins/';
|
||||||
|
|
||||||
const pluginSpecs = [];
|
|
||||||
|
|
||||||
const plugins = await fsp.readdir(moduleDir);
|
const plugins = await fsp.readdir(moduleDir);
|
||||||
await Promise.all(plugins.map(async (plugin) => {
|
const specLists = await Promise.all(plugins.map(async (plugin) => {
|
||||||
const specDir = moduleDir + plugin + specPath;
|
const specDir = moduleDir + plugin + specPath;
|
||||||
if (!fs.existsSync(specDir)) return;
|
if (!fs.existsSync(specDir)) return [];
|
||||||
const specFiles = await fsp.readdir(specDir);
|
const specFiles = await fsp.readdir(specDir);
|
||||||
for (const spec of specFiles) {
|
return specFiles.map((spec) => staticDir + plugin + specPath + spec);
|
||||||
pluginSpecs.push(staticDir + plugin + specPath + spec);
|
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
return pluginSpecs;
|
return [].concat(...specLists);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getCoreTests = async () => await fsp.readdir('src/tests/frontend/specs');
|
const getCoreTests = async () => await fsp.readdir('src/tests/frontend/specs');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue