chore: reowrked tests to use a runBrowserTest to allow previewing the results in a browser
This commit is contained in:
@@ -5,22 +5,11 @@ import { rollup } from "rollup";
|
||||
import urlPlugin from "@rollup/plugin-url";
|
||||
|
||||
import html from "../../src/index.ts";
|
||||
import serveTest from "../util/serve-test.ts";
|
||||
|
||||
/**
|
||||
* @type {OutputOptions}
|
||||
*/
|
||||
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
|
||||
chunkFileNames: '[name].js',
|
||||
entryFileNames: '[name].[extname]',
|
||||
assetFileNames: '[name].[extname]',
|
||||
};
|
||||
import {runBrowserTest} from "../util/browser-test.ts";
|
||||
|
||||
import {fileURLToPath} from "node:url";
|
||||
import handlebars from "handlebars";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
process.chdir(join(__dirname, 'fixtures'));
|
||||
|
||||
@@ -32,7 +21,7 @@ const defaultAssetInclude = [
|
||||
];
|
||||
|
||||
test.serial('web-bundle', async (t) => {
|
||||
const bundle = await rollup({
|
||||
const out = await runBrowserTest({
|
||||
input: 'index.hbs',
|
||||
treeshake: 'smallest',
|
||||
plugins: [
|
||||
@@ -46,13 +35,19 @@ test.serial('web-bundle', async (t) => {
|
||||
urlPlugin({
|
||||
include: defaultAssetInclude,
|
||||
}),
|
||||
|
||||
serveTest({
|
||||
path: 'index.html',
|
||||
t,
|
||||
})
|
||||
],
|
||||
}, {
|
||||
path: 'index.html',
|
||||
log: t.log,
|
||||
},{
|
||||
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
|
||||
chunkFileNames: '[name].js',
|
||||
entryFileNames: '[name].[extname]',
|
||||
assetFileNames: '[name].[extname]',
|
||||
});
|
||||
await bundle.generate(output);
|
||||
t.snapshot(out);
|
||||
// await bundle.generate(output);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user