import {join, dirname} from "node:path"; import {test, expect} from "@jest/globals"; import {runBrowserTest, defaultOutput, serializer} from "../util/index.ts"; import html from "../../src/index.ts"; import {fileURLToPath} from "node:url"; const __dirname = dirname(fileURLToPath(import.meta.url)); process.chdir(join(__dirname, 'fixtures')); describe("basic", ()=> { expect.addSnapshotSerializer(serializer); test('simple', async () => { const out = await runBrowserTest({ input: 'index.html', plugins: [ html({}), ] }, { }, defaultOutput); expect(out).toMatchSnapshot(); }); test('inline-script', async () => { const out = await runBrowserTest({ input: 'script.html', plugins: [ html({}), ] }, { path: 'script.html', }, defaultOutput); expect(out).toMatchSnapshot(); }); // TODO various parameters // - format: cjs, iifi, ... // - sourcemap: inline, false, (and the various exotic sourcemap options) // Watch mode tests would be its own dir // ... });