chore: switch to jest for testing
This commit is contained in:
68
test/rewrite-url/__snapshots__/test.js.snap
Normal file
68
test/rewrite-url/__snapshots__/test.js.snap
Normal file
@@ -0,0 +1,68 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`rewrite-url 1`] = `
|
||||
[
|
||||
{
|
||||
"code": "const bootstrap = (el,deps = [])=>{
|
||||
el.innerHtml = \`
|
||||
<div>load the app</div>
|
||||
\`;
|
||||
};
|
||||
|
||||
export { bootstrap };
|
||||
//# sourceMappingURL=app-88ed8fd6.js.map
|
||||
",
|
||||
"fileName": "admin/app-88ed8fd6.js",
|
||||
"map": SourceMap {
|
||||
"file": "app-88ed8fd6.js",
|
||||
"mappings": "AAAY,MAAC,SAAS,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,EAAE,GAAG;AACzC,IAAI,EAAE,CAAC,SAAS,GAAG,CAAC;AACpB;AACA,IAAI,CAAC,CAAC;AACN;;;;",
|
||||
"names": [],
|
||||
"sources": [
|
||||
"../../admin/app.js",
|
||||
],
|
||||
"sourcesContent": [
|
||||
"export const bootstrap = (el,deps = [])=>{
|
||||
el.innerHtml = \`
|
||||
<div>load the app</div>
|
||||
\`;
|
||||
}
|
||||
",
|
||||
],
|
||||
"version": 3,
|
||||
},
|
||||
"source": undefined,
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "admin/app-88ed8fd6.js.map",
|
||||
"map": undefined,
|
||||
"source": "{"version":3,"file":"app-88ed8fd6.js","sources":["../../admin/app.js"],"sourcesContent":["export const bootstrap = (el,deps = [])=>{\\n el.innerHtml = \`\\n <div>load the app</div>\\n \`;\\n}\\n"],"names":[],"mappings":"AAAY,MAAC,SAAS,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,EAAE,GAAG;AACzC,IAAI,EAAE,CAAC,SAAS,GAAG,CAAC;AACpB;AACA,IAAI,CAAC,CAAC;AACN;;;;"}",
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "admin/index.html",
|
||||
"map": undefined,
|
||||
"source": "<html><head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script src="/admin/app-88ed8fd6.js" type="module"></script>
|
||||
|
||||
|
||||
</body></html>",
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "index.html",
|
||||
"map": undefined,
|
||||
"source": "<html><head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script src="/admin/app-88ed8fd6.js" type="module"></script>
|
||||
|
||||
|
||||
</body></html>",
|
||||
},
|
||||
]
|
||||
`;
|
||||
@@ -1,74 +0,0 @@
|
||||
# Snapshot report for `test/rewrite-url/test.js`
|
||||
|
||||
The actual snapshot is saved in `test.js.snap`.
|
||||
|
||||
Generated by [AVA](https://avajs.dev).
|
||||
|
||||
## rewrite-url
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
[
|
||||
{
|
||||
code: `const bootstrap = (el,deps = [])=>{␊
|
||||
el.innerHtml = \`␊
|
||||
<div>load the app</div>␊
|
||||
\`;␊
|
||||
};␊
|
||||
␊
|
||||
export { bootstrap };␊
|
||||
//# sourceMappingURL=app-88ed8fd6.js.map␊
|
||||
`,
|
||||
fileName: 'admin/app-88ed8fd6.js',
|
||||
map: SourceMap {
|
||||
file: 'app-88ed8fd6.js',
|
||||
mappings: 'AAAY,MAAC,SAAS,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,EAAE,GAAG;AACzC,IAAI,EAAE,CAAC,SAAS,GAAG,CAAC;AACpB;AACA,IAAI,CAAC,CAAC;AACN;;;;',
|
||||
names: [],
|
||||
sources: [
|
||||
'../../admin/app.js',
|
||||
],
|
||||
sourcesContent: [
|
||||
`export const bootstrap = (el,deps = [])=>{␊
|
||||
el.innerHtml = \`␊
|
||||
<div>load the app</div>␊
|
||||
\`;␊
|
||||
}␊
|
||||
`,
|
||||
],
|
||||
version: 3,
|
||||
},
|
||||
source: undefined,
|
||||
},
|
||||
{
|
||||
code: undefined,
|
||||
fileName: 'admin/app-88ed8fd6.js.map',
|
||||
map: undefined,
|
||||
source: '{"version":3,"file":"app-88ed8fd6.js","sources":["../../admin/app.js"],"sourcesContent":["export const bootstrap = (el,deps = [])=>{\\n el.innerHtml = `\\n <div>load the app</div>\\n `;\\n}\\n"],"names":[],"mappings":"AAAY,MAAC,SAAS,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,EAAE,GAAG;AACzC,IAAI,EAAE,CAAC,SAAS,GAAG,CAAC;AACpB;AACA,IAAI,CAAC,CAAC;AACN;;;;"}',
|
||||
},
|
||||
{
|
||||
code: undefined,
|
||||
fileName: 'admin/index.html',
|
||||
map: undefined,
|
||||
source: `<html><head>␊
|
||||
</head>␊
|
||||
<body>␊
|
||||
<div id="root"></div>␊
|
||||
<script src="/admin/app-88ed8fd6.js" type="module"></script>␊
|
||||
␊
|
||||
␊
|
||||
</body></html>`,
|
||||
},
|
||||
{
|
||||
code: undefined,
|
||||
fileName: 'index.html',
|
||||
map: undefined,
|
||||
source: `<html><head>␊
|
||||
</head>␊
|
||||
<body>␊
|
||||
<div id="root"></div>␊
|
||||
<script src="/admin/app-88ed8fd6.js" type="module"></script>␊
|
||||
␊
|
||||
␊
|
||||
</body></html>`,
|
||||
},
|
||||
]
|
||||
Binary file not shown.
@@ -1,5 +1,6 @@
|
||||
import {resolve, join, dirname} from "node:path";
|
||||
import test from "ava";
|
||||
import {test, expect} from "@jest/globals";
|
||||
|
||||
import {runBrowserTest} from "../util/index.ts";
|
||||
|
||||
import html from "../../src/index.ts";
|
||||
@@ -9,8 +10,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
process.chdir(join(__dirname, 'fixtures'));
|
||||
|
||||
|
||||
test.serial('rewrite-url', async (t) => {
|
||||
|
||||
test('rewrite-url', async () => {
|
||||
const out = await runBrowserTest({
|
||||
input: {
|
||||
['index']: 'index.html',
|
||||
@@ -25,7 +25,6 @@ test.serial('rewrite-url', async (t) => {
|
||||
}),
|
||||
],
|
||||
},{
|
||||
log: t.log,
|
||||
filterOutput:{
|
||||
// TODO: Currently only need the "await getCode(bundle, output);" as output
|
||||
},
|
||||
@@ -35,8 +34,7 @@ test.serial('rewrite-url', async (t) => {
|
||||
format: 'es', // iifi and cjs should be added to tests
|
||||
sourcemap: true,// Test if #sourcemapUrl is not accidentally included in the html-output
|
||||
});
|
||||
|
||||
t.snapshot(out.code); // Snapshot the result code
|
||||
expect(out.code).toMatchSnapshot(); // Snapshot the result code
|
||||
|
||||
// const bundle = await rollup({
|
||||
// input: {
|
||||
|
||||
Reference in New Issue
Block a user