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 }) { ...@@ -9,16 +9,18 @@ export async function unstable_getStaticProps({ params }) {
world: 'world', world: 'world',
params: params || {}, params: params || {},
time: new Date().getTime(), time: new Date().getTime(),
random: Math.random(),
}, },
revalidate: false, revalidate: false,
} }
} }
export default ({ world, time, params }) => { export default ({ world, time, params, random }) => {
return ( return (
<> <>
<p>hello: {world}</p> <p>hello: {world}</p>
<span>time: {time}</span> <span>time: {time}</span>
<div>{random}</div>
<div id="params">{JSON.stringify(params)}</div> <div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div> <div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/"> <Link href="/">
......
...@@ -322,6 +322,17 @@ const runTests = (dev = false) => { ...@@ -322,6 +322,17 @@ const runTests = (dev = false) => {
) )
const escapedBuildId = buildId.replace(/[|\\{}()[\]^$+*?.-]/g, '\\$&') 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.version).toBe(1)
expect(manifest.routes).toEqual(expectedManifestRoutes()) expect(manifest.routes).toEqual(expectedManifestRoutes())
expect(manifest.dynamicRoutes).toEqual({ expect(manifest.dynamicRoutes).toEqual({
......
...@@ -401,5 +401,5 @@ export function getBrowserBodyText(browser) { ...@@ -401,5 +401,5 @@ export function getBrowserBodyText(browser) {
} }
export function normalizeRegEx(src) { 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