test: added a react application test (in the browser)

This commit is contained in:
2024-01-07 00:23:20 +01:00
parent e96c2248ee
commit 3e46055845
22 changed files with 1669 additions and 220 deletions

View File

@@ -0,0 +1,13 @@
export async function app({root}){
const states = ['started', 'tick', 'ended'];
for(let state of states){
const text = `App ${state}`;
console.log(`Test my sourcemap: ${text}`);
root.innerHTML = `<div style="align-self: center"><b>${text}</b></div>`;
await new Promise((resolve,reject)=>
setTimeout(()=>resolve(), 10)
);
}
}

View File

@@ -1 +0,0 @@
export const batman = 'bum badum badum baaaaa dum!';

View File

@@ -13,6 +13,6 @@
</head>
<body>
<div id="root">Here the app should load!</div>
<script src="./index.js" type="module"></script>
<script src="./index.mjs" type="module"></script>
</body>
</html>

View File

@@ -9,7 +9,7 @@
const [
appModule,
] = await Promise.all([
import("./batman.js"),
import("./app.mjs"),
]);
console.log("Bootstrapped, ready to go!");
@@ -20,7 +20,7 @@
}
// Start the app!
root.innerHTML = `<div style="align-self: center"><b>${appModule.batman}</b></div>`;
await appModule.app({root});
}catch(err){
console.error(err);
}

View File

@@ -11,6 +11,9 @@ Generated by [AVA](https://avajs.dev).
{
console: [
'[log] Bootstrapped, ready to go!',
'[log] Test my sourcemap: App started',
'[log] Test my sourcemap: App tick',
'[log] Test my sourcemap: App ended',
],
errors: [],
html: `<html lang="en"><head>␊
@@ -25,7 +28,7 @@ Generated by [AVA](https://avajs.dev).
<title>I'm cool!</title>␊
</head>␊
<body>␊
<div id="root"><div style="align-self: center"><b>bum badum badum baaaaa dum!</b></div></div>␊
<div id="root"><div style="align-self: center"><b>App ended</b></div></div>␊
<script src="index.js" type="module"></script>␊
@@ -34,40 +37,6 @@ Generated by [AVA](https://avajs.dev).
responses: [
'200 http://localhost/index.html',
'200 http://localhost/index.js',
'200 http://localhost/batman.js',
],
}
## copied-assets
> Snapshot 1
{
console: [
'[log] Bootstrapped, ready to go!',
],
errors: [],
html: `<html lang="en"><head>␊
<meta charset="UTF-8">␊
<title>␊
Test bundle!␊
</title>␊
<meta name="viewport" content="width=device-width, initial-scale=1">␊
<link rel="icon" href="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20512%20512%22%3E%20%20%20%20%3Ctitle%3EHTML5%20Logo%3C%2Ftitle%3E%20%20%20%20%3Cpath%20d%3D%22M108.4%200h23v22.8h21.2V0h23v69h-23V46h-21v23h-23.2M206%2023h-20.3V0h63.7v23H229v46h-23M259.5%200h24.1l14.8%2024.3L313.2%200h24.1v69h-23V34.8l-16.1%2024.8l-16.1-24.8v34.2h-22.6M348.7%200h23v46.2h32.6V69h-55.6%22%2F%3E%20%20%20%20%3Cpath%20fill%3D%22%23e44d26%22%20d%3D%22M107.6%20471l-33-370.4h362.8l-33%20370.2L255.7%20512%22%2F%3E%20%20%20%20%3Cpath%20fill%3D%22%23f16529%22%20d%3D%22M256%20480.5V131H404.3L376%20447%22%2F%3E%20%20%20%20%3Cpath%20fill%3D%22%23ebebeb%22%20d%3D%22M142%20176.3h114v45.4h-64.2l4.2%2046.5h60v45.3H154.4M156.4%20336.3H202l3.2%2036.3%2050.8%2013.6v47.4l-93.2-26%22%2F%3E%20%20%20%20%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M369.6%20176.3H255.8v45.4h109.6M361.3%20268.2H255.8v45.4h56l-5.3%2059-50.7%2013.6v47.2l93-25.8%22%2F%3E%3C%2Fsvg%3E">␊
<title>I'm cool!</title>␊
</head>␊
<body>␊
<div id="root"><div style="align-self: center"><b>bum badum badum baaaaa dum!</b></div></div>␊
<script src="index.js" type="module"></script>␊
</body></html>`,
requestsFailed: [],
responses: [
'200 http://localhost/index.html',
'200 http://localhost/index.js',
'200 http://localhost/batman.js',
'200 http://localhost/app.js',
],
}