-
-
Notifications
You must be signed in to change notification settings - Fork 386
Expand file tree
/
Copy pathtest-e2e.config.mjs
More file actions
329 lines (295 loc) · 13.3 KB
/
test-e2e.config.mjs
File metadata and controls
329 lines (295 loc) · 13.3 KB
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
export default {
ci: {
jobs: getCiJobs(),
},
tolerateError,
}
function getCiJobs() {
const linux_nodeOld = {
os: 'ubuntu-latest',
node_version: '20',
}
const linux_nodeNew = {
os: 'ubuntu-latest',
node_version: '22',
}
const windows_nodeOld = {
os: 'windows-latest',
node_version: '20',
}
const setupsExamples = [linux_nodeNew, windows_nodeOld]
return [
// Vitest
{
name: 'Vitest (unit tests)',
command: 'pnpm exec vitest run --project unit',
setups: [linux_nodeOld],
},
{
name: 'Vitest (E2E tests)',
command: 'pnpm exec vitest run --project e2e',
setups: [linux_nodeOld, windows_nodeOld],
},
// TypeScript
{
name: 'TypeScript',
command: 'pnpm exec test-types',
setups: [linux_nodeOld],
},
// @brillout/test-e2e
{
name: 'Boilerplates',
setups: [linux_nodeOld],
},
{
name: 'Examples React',
setups: setupsExamples,
},
{
name: 'Examples Vue/Others',
setups: setupsExamples,
},
{
name: 'Examples Misc',
setups: [linux_nodeOld, windows_nodeOld],
},
{
name: 'Unit Tests E2E',
setups: [linux_nodeNew, windows_nodeOld],
},
{
name: 'Extensions',
setups: [linux_nodeNew],
},
{
name: 'Cloudflare',
setups: [linux_nodeNew],
},
{
name: 'https://vike.dev',
setups: [linux_nodeNew],
},
]
}
function tolerateError({ logSource, logText, testInfo }) {
return (
[
// === Vite 8 beta
// [11:49:08.085][/test/photon-cloudflare/.test-dev.test.ts][pnpm run dev][stderr] You or a plugin you are using have set `optimizeDeps.esbuildOptions` but this option is now deprecated. Vite now uses Rolldown to optimize the dependencies. Please use `optimizeDeps.rolldownOptions` instead.
'`optimizeDeps.esbuildOptions` but this option is now deprecated',
// [11:27:26.381][\test\universal-middleware\test-preview.test.ts][npm run preview][stderr] [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugin `vike:pluginExtractAssets:append-extractAssets-query`. See https://rolldown.rs/options/checks#plugintimings for more details.
'Warning: Your build spent significant time in plugin',
// [11:16:03.710][/docs/.test-preview.test.ts][pnpm run preview][stderr] `transformWithEsbuild` is deprecated and will be removed in the future. Please migrate to `transformWithOxc`.
'`transformWithEsbuild` is deprecated and will be removed in the future',
// [09:50:40.332][/examples/react-full][npm run preview][stderr] [vite:react-swc] We recommend switching to `@vitejs/plugin-react` for improved performance as no swc plugins are used. More information at https://vite.dev/rolldown
'We recommend switching to `@vitejs/plugin-react`',
// [09:37:55.007][/examples/react-full][npm run preview][stderr] 9:37:55 AM [vite] warning: `esbuild` option was specified by "vite:react-swc" plugin. This option is deprecated, please use `oxc` instead.
'`esbuild` option was specified by',
// ===
// Error: clientOnly() is deprecated — use <ClientOnly> https://vike.dev/ClientOnly
'clientOnly() is deprecated',
/*
What seems to be a wrangler bug:
```console
[11:07:40.427][/][pnpm run preview][stderr] ▲ [WARNING] Invalid source URL: first path segment in URL cannot contain colon [invalid-source-url]
.wrangler/tmp/pages-LLnPri/606wemc1wol.js.map:3:14:
3 │ "sources": ["<define:__ROUTES__>", "../../../../../node_modules/....
╵ ~~~~~~~~~~~~~~~~~~~~~
The source map ".wrangler/tmp/pages-LLnPri/606wemc1wol.js.map" was referenced by the file ".wrangler/tmp/pages-LLnPri/606wemc1wol.js" here:
.wrangler/tmp/pages-LLnPri/606wemc1wol.js:41:21:
41 │ //# sourceMappingURL=606wemc1wol.js.map
╵ ~~~~~~~~~~~~~~~~~~
```
*/
'Invalid source URL: first path segment in URL cannot contain colon',
/*
```console
[19:47:21.367][/][npm run dev][stderr] The latest compatibility date supported by the installed Cloudflare Workers Runtime is "2025-07-12",
but you've requested "2025-07-18". Falling back to "2025-07-12"...
```
*/
'compatibility date supported by the installed Cloudflare',
/*
```shell
[12:12:28.624][/examples/cloudflare-workers-vue][npm run preview][stderr] ▲ [WARNING] "import.meta" is not available with the "iife" output format and will be empty [empty-import-meta]
../../packages/vike/dist/server/runtime/globalContext.js:511:17:
511 │ const PROD = import.meta.env.PROD;
╵ ~~~~~~~~~~~
You need to set the output format to "esm" for "import.meta" to work correctly.
```
*/
'"import.meta" is not available with the "iife" output format and will be empty',
// ```shell
// [23:57:18.027][/.test-preview.test.ts][pnpm run preview][stderr] (!) Some chunks are larger than 500 kB after minification. Consider:
// - Using dynamic import() to code-split the application
// - Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
// - Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
// ```
'Some chunks are larger than 500 kB after minification.',
// [22:04:24.193][/test-dev.test.ts][npm run dev][stderr] 10:04:24 PM [vike][request(1)][Warning] getGlobalContextSync() shouldn't be used in development, see https://vike.dev/getGlobalContext
"getGlobalContextSync() shouldn't be used in development",
// Required for test-deprecated-design/*
'Define Vike settings in +config.js instead of vite.config.js',
// Required for test-deprecated-design/*
'vite.createServer() is deprecated',
// Error: [DocPress][Warning] prop `text` is deprecated
'prop `text` is deprecated',
// [11:00:51.986][/test/cjs/test-dev.test.ts][npm run dev][stderr] (node:3061) ExperimentalWarning: CommonJS module /home/runner/work/vike/packages/vike/dist/cjs/node/plugin/index.js is loading ES Module /home/runner/work/vike/packages/vike/node_modules/.pnpm/vite@6.0.5_@types+node@20.13.0_terser@5.31.0_tsx@4.19.2/node_modules/vite/dist/node/index.js using require().
// Support for loading ES Module in require() is an experimental feature and might change at any time
'loading ES Module in require() is an experimental feature',
// (node:4188) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
'The `punycode` module is deprecated.',
// (node:4117) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
'fs.Stats constructor is deprecated.',
'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)) ||
//
// TO-DO/eventually: move everything to the array above
isViteCjsWarning() ||
isRenderErrorPageDeprecationWarning() ||
isSlowHookWarning() ||
isServiceExit() ||
isGetPageAssetsDeprecationWarning() ||
isDocpressAssetWarning() ||
isSourceMapWarning() ||
isCloudflareFalseError1() ||
isCloudflareFalseError2() ||
isCloudflareVueWarning() ||
isCloudflarePrewarmWarning() ||
isTwitterEmbedsError() ||
isGithubImageError() ||
isSlowCrawlWarning() ||
isNodeExperimentalEsmLoader() ||
isNodeExperimentalLoader() ||
isNotV1Design() ||
isVitePluginVercelWarning()
)
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/packages/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/packages/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.",
)
)
}
// [19:47:42.746][\test\vike-vercel\.test-prod.test.ts][npm run prod][stderr] .vercel\output\functions\ssr_.func\index.mjs 2.4mb
// [19:47:42.746][\test\vike-vercel\.test-prod.test.ts][npm run prod][stderr] Done in 181ms
function isVitePluginVercelWarning() {
return (
logText.replaceAll('\\', '/').includes('.vercel/output/functions') ||
(testInfo?.testFile?.includes('vike-vercel') && logText.includes('Done in')) ||
// Let's skip all test/vike-vercel/ warnings for now: https://github.com/magne4000/vite-plugin-vercel/issues/134#issuecomment-2596842125
testInfo?.testFile?.includes('vike-vercel')
)
}
}