mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-07 17:02:29 +01:00
fix (test): make dynamic import testable from jest
This commit is contained in:
parent
b8b2a86374
commit
afc687b0a6
1 changed files with 4 additions and 1 deletions
|
|
@ -39,7 +39,10 @@ async function load(route, opts) {
|
||||||
} else if (typeof spinner === "string") {
|
} else if (typeof spinner === "string") {
|
||||||
spinnerID = setTimeout(() => $root.innerHTML = spinner, spinnerTime);
|
spinnerID = setTimeout(() => $root.innerHTML = spinner, spinnerTime);
|
||||||
}
|
}
|
||||||
const module = await import("../.." + route);
|
const module = window.env === "test" ?
|
||||||
|
require("../.." + route) :
|
||||||
|
await import("../.." + route);
|
||||||
|
|
||||||
clearTimeout(spinnerID);
|
clearTimeout(spinnerID);
|
||||||
if (typeof module.default !== "function") {
|
if (typeof module.default !== "function") {
|
||||||
console.error(module, module.default);
|
console.error(module, module.default);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue