mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
tests: Use fs.promises
instead of wrapping with util.promisify
This commit is contained in:
parent
f00f9aa14c
commit
6cf27a7133
1 changed files with 4 additions and 6 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const util = require('util');
|
const fsp = fs.promises;
|
||||||
const settings = require('../../utils/Settings');
|
const settings = require('../../utils/Settings');
|
||||||
|
|
||||||
exports.expressCreateServer = (hookName, args, cb) => {
|
exports.expressCreateServer = (hookName, args, cb) => {
|
||||||
|
@ -74,8 +74,6 @@ exports.expressCreateServer = (hookName, args, cb) => {
|
||||||
return cb();
|
return cb();
|
||||||
};
|
};
|
||||||
|
|
||||||
const readdir = util.promisify(fs.readdir);
|
|
||||||
|
|
||||||
exports.getPluginTests = async (callback) => {
|
exports.getPluginTests = async (callback) => {
|
||||||
const moduleDir = 'node_modules/';
|
const moduleDir = 'node_modules/';
|
||||||
const specPath = '/static/tests/frontend/specs/';
|
const specPath = '/static/tests/frontend/specs/';
|
||||||
|
@ -83,12 +81,12 @@ exports.getPluginTests = async (callback) => {
|
||||||
|
|
||||||
const pluginSpecs = [];
|
const pluginSpecs = [];
|
||||||
|
|
||||||
const plugins = await readdir(moduleDir);
|
const plugins = await fsp.readdir(moduleDir);
|
||||||
await Promise.all(plugins
|
await Promise.all(plugins
|
||||||
.map((plugin) => [plugin, moduleDir + plugin + specPath])
|
.map((plugin) => [plugin, moduleDir + plugin + specPath])
|
||||||
.filter(([plugin, specDir]) => fs.existsSync(specDir)) // check plugin exists
|
.filter(([plugin, specDir]) => fs.existsSync(specDir)) // check plugin exists
|
||||||
.map(async ([plugin, specDir]) => {
|
.map(async ([plugin, specDir]) => {
|
||||||
const specFiles = await readdir(specDir);
|
const specFiles = await fsp.readdir(specDir);
|
||||||
return specFiles.map((spec) => {
|
return specFiles.map((spec) => {
|
||||||
pluginSpecs.push(staticDir + plugin + specPath + spec);
|
pluginSpecs.push(staticDir + plugin + specPath + spec);
|
||||||
});
|
});
|
||||||
|
@ -96,4 +94,4 @@ exports.getPluginTests = async (callback) => {
|
||||||
return pluginSpecs;
|
return pluginSpecs;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.getCoreTests = async () => await readdir('src/tests/frontend/specs');
|
exports.getCoreTests = async () => await fsp.readdir('src/tests/frontend/specs');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue