chore: switch to jest for testing
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {join, dirname} from "node:path";
|
||||
|
||||
import test from "ava";
|
||||
import {test, expect} from "@jest/globals";
|
||||
|
||||
import { rollup } from "rollup";
|
||||
import {debugPrintOutput, getCode} from "../util/index.ts";
|
||||
|
||||
@@ -16,35 +17,37 @@ import {fileURLToPath} from "node:url";
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
process.chdir(join(__dirname, 'fixtures'));
|
||||
|
||||
|
||||
test.serial('simple', async (t) => {
|
||||
const bundle = await rollup({
|
||||
input: 'index.html',
|
||||
plugins: [
|
||||
html({
|
||||
}),
|
||||
]
|
||||
describe("basic", ()=> {
|
||||
test('simple', async () => {
|
||||
const bundle = await rollup({
|
||||
input: 'index.html',
|
||||
plugins: [
|
||||
html({}),
|
||||
]
|
||||
});
|
||||
const code = await getCode(bundle, output);
|
||||
await bundle.close();
|
||||
debugPrintOutput('simple', code);
|
||||
expect(code).toMatchSnapshot();
|
||||
});
|
||||
const code = await getCode(bundle, output);
|
||||
debugPrintOutput('simple',code);
|
||||
t.snapshot(code);
|
||||
});
|
||||
|
||||
test.serial('inline-script', async (t) => {
|
||||
const bundle = await rollup({
|
||||
input: 'script.html',
|
||||
plugins: [
|
||||
html({
|
||||
}),
|
||||
]
|
||||
test('inline-script', async () => {
|
||||
const bundle = await rollup({
|
||||
input: 'script.html',
|
||||
plugins: [
|
||||
html({}),
|
||||
]
|
||||
});
|
||||
const code = await getCode(bundle, output);
|
||||
await bundle.close();
|
||||
debugPrintOutput('inline-script', code);
|
||||
expect(code).toMatchSnapshot();
|
||||
});
|
||||
const code = await getCode(bundle, output);
|
||||
debugPrintOutput('inline-script',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