diff --git a/make.js b/make.js index 7965a0634..8ce82c85b 100755 --- a/make.js +++ b/make.js @@ -256,13 +256,27 @@ async function buildStorePackage() { ]); } +function collectFiles(dir) { + const results = []; + for (const entry of Deno.readDirSync(dir)) { + const fullPath = path.join(dir, entry.name); + if (entry.isDirectory) { + results.push(...collectFiles(fullPath)); + } else if (entry.isFile) { + results.push(fullPath); + } + } + return results.sort(); +} + async function runUnitTests() { // Import every test file. const dir = path.join(projectPath, "tests/unit_tests"); - const files = Array.from(Deno.readDirSync(dir)).map((f) => f.name).sort(); + const files = collectFiles(dir); + for (let f of files) { if (f.endsWith("_test.js")) { - await import(path.join(dir, f)); + await import(f); } } diff --git a/tests/unit_tests/ui_component_test.js b/tests/unit_tests/ui_component_test.js index d60f63541..2502d1034 100644 --- a/tests/unit_tests/ui_component_test.js +++ b/tests/unit_tests/ui_component_test.js @@ -2,6 +2,7 @@ import * as testHelper from "./test_helper.js"; import "../../lib/utils.js"; import "../../lib/dom_utils.js"; import "../../content_scripts/ui_component.js"; +import "../../lib/settings.js"; function stubPostMessage(iframeEl, fn) { if (!iframeEl || !fn) throw new Error("iframeEl and fn are required."); @@ -19,6 +20,7 @@ context("UIComponent", () => { // Which page we load doesn't matter; we just need any DOM. await testHelper.jsdomStub("pages/help_dialog_page.html"); stub(Utils, "isFirefox", () => false); + await Settings.load(); }); teardown(() => {