Unverified Commit fd1636ae authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Update prerender test for Windows (#9800)

parent dcab416d
......@@ -9,16 +9,18 @@ export async function unstable_getStaticProps({ params }) {
world: 'world',
params: params || {},
time: new Date().getTime(),
random: Math.random(),
},
revalidate: false,
}
}
export default ({ world, time, params }) => {
export default ({ world, time, params, random }) => {
return (
<>
<p>hello: {world}</p>
<span>time: {time}</span>
<div>{random}</div>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
......
......@@ -322,6 +322,17 @@ const runTests = (dev = false) => {
)
const escapedBuildId = buildId.replace(/[|\\{}()[\]^$+*?.-]/g, '\\$&')
Object.keys(manifest.dynamicRoutes).forEach(key => {
const item = manifest.dynamicRoutes[key]
if (item.dataRouteRegex) {
item.dataRouteRegex = normalizeRegEx(item.dataRouteRegex)
}
if (item.routeRegex) {
item.routeRegex = normalizeRegEx(item.routeRegex)
}
})
expect(manifest.version).toBe(1)
expect(manifest.routes).toEqual(expectedManifestRoutes())
expect(manifest.dynamicRoutes).toEqual({
......
......@@ -401,5 +401,5 @@ export function getBrowserBodyText(browser) {
}
export function normalizeRegEx(src) {
return new RegExp(src).source
return new RegExp(src).source.replace(/\^\//g, '^\\/')
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment