1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
import * as assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { fileURLToPath } from 'node:url';
import { createFs, createRequestAndResponse, runInContainer } from '../test-utils.js';
const root = new URL('../../fixtures/alias/', import.meta.url);
describe('hydration', () => {
it(
'should not crash when reassigning a hydrated component',
{ skip: true, todo: "It seems that `components/Client.svelte` isn't found" },
async () => {
const fs = createFs(
{
'/src/pages/index.astro': `
---
import Svelte from '../components/Client.svelte';
const Foo = Svelte;
const Bar = Svelte;
---
<html>
<head><title>testing</title></head>
<body>
<Foo client:load />
<Bar client:load />
</body>
</html>
`,
},
root
);
await runInContainer(
{
fs,
inlineConfig: {
root: fileURLToPath(root),
logLevel: 'silent',
},
},
async (container) => {
const { req, res, done } = createRequestAndResponse({
method: 'GET',
url: '/',
});
container.handle(req, res);
await done;
assert.equal(
res.statusCode,
200,
"We get a 200 because the error occurs in the template, but we didn't crash!"
);
}
);
}
);
});
|