First private release. Check updated README.md for details
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
42
test/live-reload/test.js
Normal file
42
test/live-reload/test.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import {join, dirname} from "node:path";
|
||||
|
||||
import test from "ava";
|
||||
import {rollup} from "rollup";
|
||||
import liveReload from "rollup-plugin-livereload";
|
||||
import {debugPrintOutput, getCode} from "../util/test.js";
|
||||
|
||||
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.serial('live-reload', async (t) => {
|
||||
const bundle = await rollup({
|
||||
input: 'index.html',
|
||||
plugins: [
|
||||
html({
|
||||
}),
|
||||
liveReload({
|
||||
verbose: false// this oddly enough prevents it from actually starting the liveserver, which would've left the test to wait indefinatly to close
|
||||
})
|
||||
]
|
||||
});
|
||||
const code = await getCode(bundle, output, true);
|
||||
await bundle.close();// Make sure live-reload closes itself
|
||||
debugPrintOutput('live-reload',code);
|
||||
t.snapshot(code);
|
||||
});
|
||||
|
||||
// TODO various parameters
|
||||
// - format: cjs, iifi, ...
|
||||
// - sourcemap: inline, false, (and the various exotic sourcemap options)
|
||||
// Watch mode tests would be its own dir
|
||||
// ...
|
||||
Reference in New Issue
Block a user