chore: switch to jest for testing

This commit is contained in:
2024-02-21 00:04:36 +01:00
parent 3b540d0c48
commit e46f668ac8
47 changed files with 50329 additions and 839 deletions

View File

@@ -1,6 +1,6 @@
import {join, dirname} from "node:path";
import {test, expect} from "@jest/globals";
import test from "ava";
import { rollup } from "rollup";
import urlPlugin from "@rollup/plugin-url";
@@ -25,40 +25,43 @@ const defaultAssetInclude = [
'**/*.(webm|mp4)',// video
];
test.serial('copied-assets', async (t) => {
const bundle = await rollup({
input: 'index.html',
plugins: [
html({
}),
urlPlugin({
include: defaultAssetInclude,
limit: 0,// Never inline something
}),
],
describe("url-plugin", ()=>{
test('copied-assets', async () => {
const bundle = await rollup({
input: 'index.html',
plugins: [
html({
}),
urlPlugin({
include: defaultAssetInclude,
limit: 0,// Never inline something
}),
],
});
const code = await getCode(bundle, output);
debugPrintOutput('copied-assets',code);
expect(code).toMatchSnapshot();
});
const code = await getCode(bundle, output);
debugPrintOutput('copied-assets',code);
t.snapshot(code);
});
test.serial('inlined-assets', async (t) => {
const bundle = await rollup({
input: 'index.html',
plugins: [
html({
}),
urlPlugin({
include: defaultAssetInclude,
limit: Number.MAX_SAFE_INTEGER,// Always inline things
}),
]
test('inlined-assets', async () => {
const bundle = await rollup({
input: 'index.html',
plugins: [
html({
}),
urlPlugin({
include: defaultAssetInclude,
limit: Number.MAX_SAFE_INTEGER,// Always inline things
}),
]
});
const code = await getCode(bundle, output);
debugPrintOutput('inlined-assets',code);
expect(code).toMatchSnapshot();
});
const code = await getCode(bundle, output);
debugPrintOutput('inlined-assets',code);
t.snapshot(code);
});
})
// TODO various parameters
// - format: cjs, iifi, ...