tests: Simplify iteration over frontend test specs
parent
b85a040f13
commit
1be1b704f1
|
@ -138,24 +138,15 @@ $(() => {
|
||||||
|
|
||||||
const getURLParameter = (name) => (new URLSearchParams(location.search)).get(name);
|
const getURLParameter = (name) => (new URLSearchParams(location.search)).get(name);
|
||||||
|
|
||||||
// get the list of specs and filter it if requested
|
|
||||||
const specs = specs_list.slice();
|
|
||||||
|
|
||||||
const absUrl = (url) => new URL(url, window.location.href).href;
|
const absUrl = (url) => new URL(url, window.location.href).href;
|
||||||
require.setRootURI(absUrl('../../javascripts/src'));
|
require.setRootURI(absUrl('../../javascripts/src'));
|
||||||
require.setLibraryURI(absUrl('../../javascripts/lib'));
|
require.setLibraryURI(absUrl('../../javascripts/lib'));
|
||||||
require.setGlobalKeyPath('require');
|
require.setGlobalKeyPath('require');
|
||||||
|
|
||||||
// inject spec scripts into the dom
|
|
||||||
const $body = $('body');
|
const $body = $('body');
|
||||||
$.each(specs, (i, spec) => {
|
for (const spec of specs_list.map((spec) => encodeURI(spec))) {
|
||||||
// if the spec isn't a plugin spec which means the spec file might be in a different subfolder
|
$body.append($('<script>').attr('src', spec.startsWith('/') ? spec : `specs/${spec}`));
|
||||||
if (!spec.startsWith('/')) {
|
}
|
||||||
$body.append(`<script src="specs/${spec}"></script>`);
|
|
||||||
} else {
|
|
||||||
$body.append(`<script src="${spec}"></script>`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// initialize the test helper
|
// initialize the test helper
|
||||||
helper.init(() => {
|
helper.init(() => {
|
||||||
|
|
Loading…
Reference in New Issue