mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01: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 specPath = '/static/tests/frontend/specs/';
|
||||
const staticDir = '/static/plugins/';
|
||||
|
||||
const pluginSpecs = [];
|
||||
|
||||
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;
|
||||
if (!fs.existsSync(specDir)) return;
|
||||
if (!fs.existsSync(specDir)) return [];
|
||||
const specFiles = await fsp.readdir(specDir);
|
||||
for (const spec of specFiles) {
|
||||
pluginSpecs.push(staticDir + plugin + specPath + spec);
|
||||
}
|
||||
return specFiles.map((spec) => staticDir + plugin + specPath + spec);
|
||||
}));
|
||||
return pluginSpecs;
|
||||
return [].concat(...specLists);
|
||||
};
|
||||
|
||||
const getCoreTests = async () => await fsp.readdir('src/tests/frontend/specs');
|
||||
|
|
Loading…
Reference in a new issue