From d87b4e0c20ccd03771833c878345edc4b39139a1 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 9 May 2021 16:23:49 -0400 Subject: [PATCH] tests: Use `async`/`await` instead of returning Promises This makes stack traces more useful. --- src/node/hooks/express/tests.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node/hooks/express/tests.js b/src/node/hooks/express/tests.js index c533ae8ca..247c8fb97 100644 --- a/src/node/hooks/express/tests.js +++ b/src/node/hooks/express/tests.js @@ -87,12 +87,12 @@ exports.getPluginTests = async (callback) => { const promises = plugins .map((plugin) => [plugin, moduleDir + plugin + specPath]) .filter(([plugin, specDir]) => fs.existsSync(specDir)) // check plugin exists - .map(([plugin, specDir]) => readdir(specDir) + .map(async ([plugin, specDir]) => await readdir(specDir) .then((specFiles) => specFiles.map((spec) => { pluginSpecs.push(staticDir + plugin + specPath + spec); }))); - return Promise.all(promises).then(() => pluginSpecs); + return await Promise.all(promises).then(() => pluginSpecs); }; -exports.getCoreTests = () => readdir('src/tests/frontend/specs'); +exports.getCoreTests = async () => await readdir('src/tests/frontend/specs');