Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions make.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
2 changes: 2 additions & 0 deletions tests/unit_tests/ui_component_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand All @@ -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(() => {
Expand Down