/
ssr-deps.spec.ts
100 lines (86 loc) · 2.62 KB
/
ssr-deps.spec.ts
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import { port } from './serve'
import { page } from '~utils'
const url = `http://localhost:${port}`
/**
* test for #5809
*
* NOTE: This test will always succeed now, unless the temporary workaround for Jest can be removed
* See https://github.com/vitejs/vite/pull/5197#issuecomment-938054077
*/
test('msg should be encrypted', async () => {
await page.goto(url)
expect(await page.textContent('.encrypted-msg')).not.toMatch(
'Secret Message!'
)
})
test('msg read by fs/promises', async () => {
await page.goto(url)
expect(await page.textContent('.file-message')).toMatch('File Content!')
})
test('msg from primitive export', async () => {
await page.goto(url)
expect(await page.textContent('.primitive-export-message')).toMatch(
'Hello World!'
)
})
test('msg from TS transpiled exports', async () => {
await page.goto(url)
expect(await page.textContent('.ts-default-export-message')).toMatch(
'Hello World!'
)
expect(await page.textContent('.ts-named-export-message')).toMatch(
'Hello World!'
)
})
test('msg from Object.assign exports', async () => {
await page.goto(url)
expect(await page.textContent('.object-assigned-exports-message')).toMatch(
'Hello World!'
)
})
test('msg from forwarded exports', async () => {
await page.goto(url)
expect(await page.textContent('.forwarded-export-message')).toMatch(
'Hello World!'
)
})
test('msg from define properties exports', async () => {
await page.goto(url)
expect(await page.textContent('.define-properties-exports-msg')).toMatch(
'Hello World!'
)
})
test('msg from define property exports', async () => {
await page.goto(url)
expect(await page.textContent('.define-property-exports-msg')).toMatch(
'Hello World!'
)
})
test('msg from only object assigned exports', async () => {
await page.goto(url)
expect(await page.textContent('.only-object-assigned-exports-msg')).toMatch(
'Hello World!'
)
})
test('msg from no external cjs', async () => {
await page.goto(url)
expect(await page.textContent('.no-external-cjs-msg')).toMatch('Hello World!')
})
test('msg from optimized with nested external', async () => {
await page.goto(url)
expect(await page.textContent('.optimized-with-nested-external')).toMatch(
'Hello World!'
)
})
test('msg from optimized cjs with nested external', async () => {
await page.goto(url)
expect(await page.textContent('.optimized-cjs-with-nested-external')).toMatch(
'Hello World!'
)
})
test('msg from external using external entry', async () => {
await page.goto(url)
expect(await page.textContent('.external-using-external-entry')).toMatch(
'Hello World!'
)
})