-
Notifications
You must be signed in to change notification settings - Fork 33
/
test-e2e.config.mjs
123 lines (112 loc) · 3.55 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
export default {
ci: {
jobs: getCiJobs(),
},
tolerateError,
}
function getCiJobs() {
const ubuntu20 = {
os: 'ubuntu-latest',
node_version: '20',
}
const win18 = {
os: 'windows-latest',
node_version: '18',
}
const setups = [ubuntu20, win18]
const setupModern = [ubuntu20]
return [
{
name: 'Vite',
setups,
},
{
name: 'React Native',
setups,
},
{
name: 'Cloudflare Workers',
setups: setupModern,
},
{
name: 'Next.js',
setups,
},
{
name: 'Nuxt 2',
setups,
},
{
name: 'SvelteKit',
setups,
},
{
name: 'https://telefunc.com',
setups: setupModern,
},
]
}
function tolerateError({ logSource, logText }) {
return (
// TODO: move everything to this array
[
// Error: [DocPress][Warning] prop `text` is deprecated
'prop `text` is deprecated',
// [18:54:59.547][/docs/.test-preview.test.ts][pnpm run preview][stderr] warnings when minifying css:
// Warning: G] Transforming this CSS nesting syntax is not supported in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14") [unsupported-css-nesting]
'CSS nesting syntax is not supported in the configured target environment',
// [11:03:16.814][/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',
].some((t) => logText.includes(t)) ||
isRollupEmptyChunkWarning() ||
isSveltekitTypesGenWarning() ||
isCJSVikeWarning() ||
isCJSViteWarning() ||
isVikeDeprecatedDesignWarning() ||
isNextJsEslintWarning()
)
function isRollupEmptyChunkWarning() {
return logSource === 'stderr' && logText.includes('Generated an empty chunk: "hooks"')
}
function isSveltekitTypesGenWarning() {
return logSource === 'stderr' && logText.includes('Cannot find base config file "./.svelte-kit/tsconfig.json"')
}
function isCJSVikeWarning() {
return (
logSource === 'stderr' &&
logText.includes('We recommend setting ') &&
logText.includes('/package.json#type to "module", see https://vike.dev/CJS')
)
}
function isCJSViteWarning() {
return (
logSource === 'stderr' &&
logText.includes(
"The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.",
)
)
}
function isVikeDeprecatedDesignWarning() {
return (
logSource === 'stderr' &&
(logText.includes(
// Old warning
'You are using the old deprecated design, update to the new V1 design, see https://vike.dev/migration/v1-design',
) ||
logText.includes(
// New warning
"You are using Vike's deprecated design. Update to the new V1 design, see https://vike.dev/migration/v1-design for how to migrate.",
))
)
}
function isNextJsEslintWarning() {
return (
logSource === 'stderr' &&
logText.includes(
"DeprecationWarning: 'originalKeywordKind' has been deprecated since v5.0.0 and will no longer be usable after v5.2.0. Use 'identifierToKeywordKind(identifier)' instead.",
)
)
}
}