feat: scaffold Firefox extension skeleton with manifest validation tests
Manifest V3 (Firefox keys: background.scripts, host_permissions), a background event page that opens a standalone list page on toolbar click, and the placeholder list page (HTML/CSS/JS vanilla). No build step. extension.test.ts validates manifest shape and referenced files. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
328df2d181
commit
0b1c022247
@@ -0,0 +1,45 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { existsSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
||||
const extensionDir = join(import.meta.dir, "extension");
|
||||
const manifest = await Bun.file(join(extensionDir, "manifest.json")).json();
|
||||
|
||||
describe("manifest.json", () => {
|
||||
test("est en Manifest V3", () => {
|
||||
expect(manifest.manifest_version).toBe(3);
|
||||
});
|
||||
|
||||
test("déclare background.js comme script d'arrière-plan", () => {
|
||||
expect(manifest.background.scripts).toContain("background.js");
|
||||
});
|
||||
|
||||
test("demande les host_permissions des deux sources", () => {
|
||||
expect(manifest.host_permissions).toEqual([
|
||||
"https://atelier-huit.frama.space/*",
|
||||
"https://www.ville-cugnaux.fr/*",
|
||||
]);
|
||||
});
|
||||
|
||||
test("ne définit PAS default_popup (sinon onClicked devient muet)", () => {
|
||||
expect(manifest.action.default_popup).toBeUndefined();
|
||||
});
|
||||
|
||||
test("porte un identifiant gecko", () => {
|
||||
expect(manifest.browser_specific_settings.gecko.id).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("ressources référencées", () => {
|
||||
test("background.js existe", () => {
|
||||
expect(existsSync(join(extensionDir, "background.js"))).toBe(true);
|
||||
});
|
||||
|
||||
test("liste.html existe", () => {
|
||||
expect(existsSync(join(extensionDir, "liste.html"))).toBe(true);
|
||||
});
|
||||
|
||||
test("l'icône référencée existe", () => {
|
||||
expect(existsSync(join(extensionDir, manifest.action.default_icon))).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user