forked from vikejs/vike
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-e2e.config.mjs
198 lines (186 loc) · 6.08 KB
/
test-e2e.config.mjs
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
export default {
ci: {
jobs: getCiJobs()
},
tolerateError
}
function getCiJobs() {
const ubuntu16 = {
os: 'ubuntu-latest',
node_version: '16'
}
const ubuntu17 = {
os: 'ubuntu-latest',
node_version: '17'
}
const ubuntu20 = {
os: 'ubuntu-latest',
node_version: '20'
}
const win16 = {
os: 'windows-latest',
node_version: '16'
}
const win18 = {
os: 'windows-latest',
node_version: '18'
}
const mac17 = {
os: 'macos-latest',
node_version: '17'
}
const setupsExamples = [ubuntu20, win16]
return [
{
name: 'Boilerplates',
setups: [ubuntu17]
},
{
name: 'Examples React',
setups: setupsExamples
},
{
name: 'Examples Vue/Others',
setups: setupsExamples
},
{
name: 'Examples Misc',
setups: [ubuntu16, mac17, win16]
},
{
name: 'Unit Tests E2E',
setups: [ubuntu16, win18]
},
{
name: 'Cloudflare',
setups: [ubuntu16]
},
{
name: 'https://vite-plugin-ssr.com',
setups: [ubuntu17]
},
{
name: 'pageFilesSrc',
setups: [ubuntu17]
}
]
}
function tolerateError({ logSource, logText }) {
return (
isSlowHookWarning() ||
isNoErrorPageWarning() ||
isServiceExit() ||
isGetPageAssetsDeprecationWarning() ||
isDocpressAssetWarning() ||
isSourceMapWarning() ||
isCloudflareFalseError1() ||
isCloudflareFalseError2() ||
isCloudflareVueWarning() ||
isTwitterEmbedsError() ||
isGithubImageError() ||
isSlowCrawlWarning() ||
isHtmlEscapingTest()
)
// [[email protected]][Warning] The onBeforeRender() hook of /pages/star-wars/index/index.page.server.ts is taking more than 4 seconds
function isSlowHookWarning() {
return (
logSource === 'stderr' &&
logText.includes('[Warning]') &&
logText.includes('hook') &&
logText.includes('is taking more than 4 seconds')
)
}
// [[email protected]][Warning] No `_error.page.js` found. We recommend creating a `_error.page.js` file. (This warning is not shown in production.)
function isNoErrorPageWarning() {
return (
logSource === 'stderr' &&
logText.includes(
'No `_error.page.js` found. We recommend creating a `_error.page.js` file. (This warning is not shown in production.)'
)
)
}
// These seems to come from esbuild
// ```
// [16:41:56.607][\examples\preact-server-routing][npm run preview][stderr] 4:41:56 PM [vite] Internal server error: The service was stopped
// Plugin: vite:esbuild
// File: D:/a/vite-plugin-ssr/vite-plugin-ssr/examples/preact-server-routing/renderer/_error.page.jsx
// at D:\a\vite-plugin-ssr\vite-plugin-ssr\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:1381:29
// ```
// [16:10:29.456][\examples\preact-client-routing][npm run preview][stderr] 4:10:29 PM [vite] Internal server error: The service is no longer running
// ```
// [16:38:26.428][\examples\i18n][npm run dev][stderr] Error: The service was stopped
// at D:\a\vite-plugin-ssr\vite-plugin-ssr\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:1381:29
// ```
// [08:35:12.487][/examples/preact-client-routing-v1][npm run preview][stderr] The service is no longer running: write EPIPE
// ```
function isServiceExit() {
return (
logSource === 'stderr' &&
(logText.includes('The service is no longer running') || logText.includes('The service was stopped'))
)
}
// [[email protected]][Warning] pageContext._getPageAssets() deprecated, see https://vite-plugin-ssr.com/preload
function isGetPageAssetsDeprecationWarning() {
return (
logSource === 'stderr' &&
logText.includes('[vite-plugin-ssr@') &&
logText.includes('[Warning]') &&
logText.includes('pageContext._getPageAssets() deprecated')
)
}
// /assets/Inter-Var-IOAEQULN.ttf referenced in /home/runner/work/vite-plugin-ssr/vite-plugin-ssr/node_modules/.pnpm/@[email protected]_6bdbsu2yzpeczxw5qylih75b3i/node_modules/@brillout/docpress/dist/renderer/_default.page.client.css?used didn't resolve at build time, it will remain unchanged to be resolved at runtime
function isDocpressAssetWarning() {
return (
logSource === 'stderr' &&
logText.includes("didn't resolve at build time, it will remain unchanged to be resolved at runtime") &&
logText.includes('node_modules/@brillout/docpress')
)
}
function isSourceMapWarning() {
return logSource === 'stderr' && logText.includes('Sourcemap for "/@react-refresh" points to missing source files')
}
function isCloudflareFalseError1() {
return (
logSource === 'stderr' &&
logText.includes(
'Enabling node.js compatibility mode for built-ins and globals. This is experimental and has serious tradeoffs.'
)
)
}
function isCloudflareFalseError2() {
return logSource === 'stderr' && logText.includes('Script modified; context reset.')
}
function isCloudflareVueWarning() {
return (
logSource === 'stderr' &&
logText.includes('Feature flags __VUE_OPTIONS_API__, __VUE_PROD_DEVTOOLS__ are not explicitly defined.')
)
}
function isTwitterEmbedsError() {
return (
logSource === 'Browser Error' &&
logText.includes('https://syndication.twitter.com') &&
logText.includes('the server responded with a status of 403')
)
}
function isGithubImageError() {
return (
logSource === 'Browser Error' &&
logText.includes('https://github.com/') &&
logText.includes('.png') &&
logText.includes('the server responded with a status of 429')
)
}
function isSlowCrawlWarning() {
return logSource === 'stderr' && logText.includes('Crawling your user files took an unexpected long time')
}
function isHtmlEscapingTest() {
return (
logSource === 'stderr' &&
logText.includes(
'The 2nd HTML variable is `<b>I was defined without an HTML Fragment</b>` which seems to be HTML code'
) &&
logText.includes('Did you forget to wrap the value with dangerouslySkipEscape')
)
}
}