-
-
Notifications
You must be signed in to change notification settings - Fork 348
/
test-e2e.config.mjs
215 lines (202 loc) · 7.28 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
export default {
ci: {
jobs: getCiJobs()
},
tolerateError
}
function getCiJobs() {
const linux_nodeOld = {
os: 'ubuntu-latest',
node_version: '18'
}
const linux_nodeNew = {
os: 'ubuntu-latest',
node_version: '20'
}
const windows_nodeOld = {
os: 'windows-latest',
node_version: '18'
}
const macos_nodeOld = {
os: 'macos-latest',
node_version: '18'
}
const setupsExamples = [linux_nodeNew, windows_nodeOld]
return [
{
name: 'Boilerplates',
setups: [linux_nodeOld]
},
{
name: 'Examples React',
setups: setupsExamples
},
{
name: 'Examples Vue/Others',
setups: setupsExamples
},
{
name: 'Examples Misc',
setups: [linux_nodeOld, macos_nodeOld, windows_nodeOld]
},
{
name: 'Unit Tests E2E',
setups: [linux_nodeNew, windows_nodeOld]
},
{
name: 'Cloudflare',
setups: [linux_nodeNew]
},
{
name: 'https://vike.dev',
setups: [linux_nodeNew]
}
]
}
function tolerateError({ logSource, logText }) {
return (
isViteCjsWarning() ||
isRenderErrorPageDeprecationWarning() ||
isSlowHookWarning() ||
isServiceExit() ||
isGetPageAssetsDeprecationWarning() ||
isDocpressAssetWarning() ||
isSourceMapWarning() ||
isCloudflareFalseError1() ||
isCloudflareFalseError2() ||
isCloudflareVueWarning() ||
isCloudflarePrewarmWarning() ||
isTwitterEmbedsError() ||
isGithubImageError() ||
isSlowCrawlWarning() ||
isNodeExperimentalEsmLoader() ||
isNodeExperimentalLoader() ||
isNotV1Design() ||
// TODO: move everything to this array
[
// [15:31:51.518][/docs/.test-dev.test.ts][pnpm run dev][stderr] Cannot optimize dependency: @brillout/docpress/renderer/onRenderClient, present in 'optimizeDeps.include'
'Cannot optimize dependency: @brillout/docpress/renderer/onRenderClient',
// [21:29:57.330][/docs/.test-dev.test.ts][pnpm run dev][stderr] Cannot optimize dependency: @brillout/docpress/Layout, present in 'optimizeDeps.include'
'Cannot optimize dependency: @brillout/docpress/Layout',
'The glob option "as" has been deprecated in favour of "query"',
// [vike][request(1)][Warning] The onBeforeRender() hook defined by /renderer/+onBeforeRender.js is slow: it's taking more than 4 seconds (https://vike.dev/hooksTimeout)
"is slow: it's taking more than"
].some((t) => logText.includes(t))
)
function isViteCjsWarning() {
return logSource === 'stderr' && logText.includes("The CJS build of Vite's Node API is deprecated")
}
function isRenderErrorPageDeprecationWarning() {
return (
logSource === 'stderr' &&
logText.includes('[Warning]') &&
logText.includes('throw RenderErrorPage()') &&
logText.includes(
'is deprecated and will be removed in the next major release. Use throw render() or throw redirect() instead'
)
)
}
// [vike@0.4.42][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')
)
}
// 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/vike/vike/examples/preact-server-routing/renderer/_error.page.jsx
// at D:\a\vike\vike\node_modules\.pnpm\esbuild@0.14.47\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\vike\vike\node_modules\.pnpm\esbuild@0.14.47\node_modules\esbuild\lib\main.js:1381:29
// ```
// [08:35:12.487][/examples/preact-client-routing][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'))
)
}
// [vike@0.4.51][Warning] pageContext._getPageAssets() deprecated, see https://vike.dev/preloading
function isGetPageAssetsDeprecationWarning() {
return (
logSource === 'stderr' &&
logText.includes('[vike@') &&
logText.includes('[Warning]') &&
logText.includes('pageContext._getPageAssets() deprecated')
)
}
// /assets/Inter-Var-IOAEQULN.ttf referenced in /home/runner/work/vike/vike/node_modules/.pnpm/@brillout+docpress@0.1.12_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 isCloudflarePrewarmWarning() {
return logSource === 'stderr' && logText.includes('worker failed to prewarm')
}
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 + files took an unexpected long time')
}
function isNodeExperimentalEsmLoader() {
return (
logSource === 'stderr' && logText.includes('ExperimentalWarning: Custom ESM Loaders is an experimental feature')
)
}
function isNodeExperimentalLoader() {
return logSource === 'stderr' && logText.includes('ExperimentalWarning: `--experimental-loader` may be removed')
}
function isNotV1Design() {
return (
logSource === 'stderr' &&
logText.includes(
"You are using Vike's deprecated design. Update to the new V1 design, see https://vike.dev/migration/v1-design for how to migrate."
)
)
}
}