41 lines
1.1 KiB
JavaScript

import {resolve, 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";
const output = {
dir: 'output', // Output all files
format: 'es', // iifi and cjs should be added to tests
sourcemap: true,// Test if #sourcemapUrl is not accidentally included in the html-output
};
import {fileURLToPath} from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
process.chdir(join(__dirname, 'fixtures'));
test('multi-entry', async () => {
const bundle = await rollup({
input: {
['index']: 'index.html',
['admin/index']: resolve(__dirname,'fixtures','admin/index.html'),
},
plugins: [
html({
}),
]
});
const code = await getCode(bundle, output);
debugPrintOutput('multi-entry',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
// ...