chore: switch to jest for testing
This commit is contained in:
@@ -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, ...
|
||||
|
||||
Reference in New Issue
Block a user