Skip to content

Commit c6ce93e

Browse files
committed
test: allow hyphens in hash for server routes preload links
Updates the regular expressions in server-routes-preload-links.ts to allow hyphens in the generated file hashes (changing [a-zA-Z0-9_]{8} to [a-zA-Z0-9_-]{8}). This ensures that the test correctly identifies modulepreload links when the hash contains a hyphen, preventing failures due to overly strict matching.
1 parent 5b5c873 commit c6ce93e

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

tests/e2e/tests/build/server-rendering/server-routes-preload-links.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,36 +137,36 @@ const RESPONSE_EXPECTS: Record<
137137
}
138138
> = {
139139
'/': {
140-
matches: [/<link rel="modulepreload" href="(home-[a-zA-Z0-9_]{8}\.js)">/],
140+
matches: [/<link rel="modulepreload" href="(home-[a-zA-Z0-9_-]{8}\.js)">/],
141141
notMatches: [/ssg\-component/, /ssr/, /csr/, /cross-dep-/],
142142
},
143143
'/ssg': {
144144
matches: [
145-
/<link rel="modulepreload" href="(ssg\.routes-[a-zA-Z0-9_]{8}\.js)">/,
146-
/<link rel="modulepreload" href="(ssg-component-[a-zA-Z0-9_]{8}\.js)">/,
145+
/<link rel="modulepreload" href="(ssg\.routes-[a-zA-Z0-9_-]{8}\.js)">/,
146+
/<link rel="modulepreload" href="(ssg-component-[a-zA-Z0-9_-]{8}\.js)">/,
147147
],
148148
notMatches: [/home/, /ssr/, /csr/, /ssg-one/, /ssg-two/, /cross-dep-/],
149149
},
150150
'/ssg/one': {
151151
matches: [
152-
/<link rel="modulepreload" href="(ssg\.routes-[a-zA-Z0-9_]{8}\.js)">/,
153-
/<link rel="modulepreload" href="(ssg-one-[a-zA-Z0-9_]{8}\.js)">/,
152+
/<link rel="modulepreload" href="(ssg\.routes-[a-zA-Z0-9_-]{8}\.js)">/,
153+
/<link rel="modulepreload" href="(ssg-one-[a-zA-Z0-9_-]{8}\.js)">/,
154154
],
155155
notMatches: [/home/, /ssr/, /csr/, /ssg-two/, /ssg\-component/, /cross-dep-/],
156156
},
157157
'/ssg/two': {
158158
matches: [
159-
/<link rel="modulepreload" href="(ssg\.routes-[a-zA-Z0-9_]{8}\.js)">/,
160-
/<link rel="modulepreload" href="(ssg-two-[a-zA-Z0-9_]{8}\.js)">/,
159+
/<link rel="modulepreload" href="(ssg\.routes-[a-zA-Z0-9_-]{8}\.js)">/,
160+
/<link rel="modulepreload" href="(ssg-two-[a-zA-Z0-9_-]{8}\.js)">/,
161161
],
162162
notMatches: [/home/, /ssr/, /csr/, /ssg-one/, /ssg\-component/, /cross-dep-/],
163163
},
164164
'/ssr': {
165-
matches: [/<link rel="modulepreload" href="(ssr-[a-zA-Z0-9_]{8}\.js)">/],
165+
matches: [/<link rel="modulepreload" href="(ssr-[a-zA-Z0-9_-]{8}\.js)">/],
166166
notMatches: [/home/, /ssg\-component/, /csr/],
167167
},
168168
'/csr': {
169-
matches: [/<link rel="modulepreload" href="(csr-[a-zA-Z0-9_]{8}\.js)">/],
169+
matches: [/<link rel="modulepreload" href="(csr-[a-zA-Z0-9_-]{8}\.js)">/],
170170
notMatches: [/home/, /ssg\-component/, /ssr/, /cross-dep-/],
171171
},
172172
};

0 commit comments

Comments
 (0)