mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
tests: Combine .map().filter().map()
into single .map()
This commit is contained in:
parent
2414203434
commit
a8e77126e8
1 changed files with 8 additions and 9 deletions
|
@ -61,15 +61,14 @@ const getPluginTests = async (callback) => {
|
||||||
const pluginSpecs = [];
|
const pluginSpecs = [];
|
||||||
|
|
||||||
const plugins = await fsp.readdir(moduleDir);
|
const plugins = await fsp.readdir(moduleDir);
|
||||||
await Promise.all(plugins
|
await Promise.all(plugins.map(async (plugin) => {
|
||||||
.map((plugin) => [plugin, moduleDir + plugin + specPath])
|
const specDir = moduleDir + plugin + specPath;
|
||||||
.filter(([plugin, specDir]) => fs.existsSync(specDir)) // check plugin exists
|
if (!fs.existsSync(specDir)) return;
|
||||||
.map(async ([plugin, specDir]) => {
|
const specFiles = await fsp.readdir(specDir);
|
||||||
const specFiles = await fsp.readdir(specDir);
|
for (const spec of specFiles) {
|
||||||
for (const spec of specFiles) {
|
pluginSpecs.push(staticDir + plugin + specPath + spec);
|
||||||
pluginSpecs.push(staticDir + plugin + specPath + spec);
|
}
|
||||||
}
|
}));
|
||||||
}));
|
|
||||||
return pluginSpecs;
|
return pluginSpecs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue