48 lines
1.1 KiB
JavaScript
48 lines
1.1 KiB
JavaScript
import {join, dirname} from "node:path";
|
|
|
|
import {test, expect} from "@jest/globals";
|
|
|
|
import { rollup } from "rollup";
|
|
import {debugPrintOutput, getCode} 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", ()=> {
|
|
test('simple', async () => {
|
|
const bundle = await rollup({
|
|
input: 'index.html',
|
|
plugins: [
|
|
html({}),
|
|
]
|
|
});
|
|
const code = await getCode(bundle);
|
|
await bundle.close();
|
|
debugPrintOutput('simple', code);
|
|
expect(code).toMatchSnapshot();
|
|
});
|
|
|
|
test('inline-script', async () => {
|
|
const bundle = await rollup({
|
|
input: 'script.html',
|
|
plugins: [
|
|
html({}),
|
|
]
|
|
});
|
|
const code = await getCode(bundle);
|
|
await bundle.close();
|
|
debugPrintOutput('inline-script', code);
|
|
expect(code).toMatchSnapshot();
|
|
});
|
|
|
|
// TODO various parameters
|
|
// - format: cjs, iifi, ...
|
|
// - sourcemap: inline, false, (and the various exotic sourcemap options)
|
|
// Watch mode tests would be its own dir
|
|
// ...
|
|
|
|
});
|