tests: Use require() to load frontend test specs

This makes core and plugin tests consistent with each other, makes it
possible to `require()` relative paths in spec files, simplifies the
code somewhat, and should make it easier to move away from
require-kernel.

Also:
  * Wrap plugin tests inside a `describe()` that contains the plugin
    name to make it easier to grep for a plugin's tests and for
    consistency with core tests.
  * Add "<core>" to the core test descriptions to make it easier to
    distinguish them from plugin tests.
This commit is contained in:
Richard Hansen 2021-05-08 19:28:08 -04:00
parent d8eb79428f
commit e4f011df76
3 changed files with 38 additions and 38 deletions

View file

@ -165,6 +165,8 @@ const minify = async (req, res) => {
filename = path.join('../node_modules/', library, libraryPath);
}
}
const [, spec] = /^plugins\/ep_etherpad-lite\/(tests\/frontend\/specs\/.*)/.exec(filename) || [];
if (spec != null) filename = `../${spec}`;
const contentType = mime.lookup(filename);