mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
tests: Avoid .then()
inside async
functions
This commit is contained in:
parent
d87b4e0c20
commit
f00f9aa14c
1 changed files with 8 additions and 7 deletions
|
@ -84,15 +84,16 @@ exports.getPluginTests = async (callback) => {
|
|||
const pluginSpecs = [];
|
||||
|
||||
const plugins = await readdir(moduleDir);
|
||||
const promises = plugins
|
||||
await Promise.all(plugins
|
||||
.map((plugin) => [plugin, moduleDir + plugin + specPath])
|
||||
.filter(([plugin, specDir]) => fs.existsSync(specDir)) // check plugin exists
|
||||
.map(async ([plugin, specDir]) => await readdir(specDir)
|
||||
.then((specFiles) => specFiles.map((spec) => {
|
||||
pluginSpecs.push(staticDir + plugin + specPath + spec);
|
||||
})));
|
||||
|
||||
return await Promise.all(promises).then(() => pluginSpecs);
|
||||
.map(async ([plugin, specDir]) => {
|
||||
const specFiles = await readdir(specDir);
|
||||
return specFiles.map((spec) => {
|
||||
pluginSpecs.push(staticDir + plugin + specPath + spec);
|
||||
});
|
||||
}));
|
||||
return pluginSpecs;
|
||||
};
|
||||
|
||||
exports.getCoreTests = async () => await readdir('src/tests/frontend/specs');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue