Skip to content

Commit

Permalink
Fix getServerSideProps Test Case (#10862)
Browse files Browse the repository at this point in the history
* Fix `getServerSideProps` Test Case

* Data requests should fail instead of rendering
  • Loading branch information
Timer committed Mar 6, 2020
1 parent b274fe3 commit 49369d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/next/next-server/server/render.tsx
Expand Up @@ -568,7 +568,7 @@ export async function renderToHTML(
;(renderOpts as any).pageData = props
}
} catch (err) {
if (!dev || !err) throw err
if (isDataReq || !dev || !err) throw err
ctx.err = err
renderOpts.err = err
console.error(err)
Expand Down
4 changes: 2 additions & 2 deletions test/integration/getserversideprops/test/index.test.js
Expand Up @@ -295,10 +295,10 @@ const runTests = (dev = false) => {
it('should reload page on failed data request', async () => {
const browser = await webdriver(appPort, '/')
await waitFor(500)
await browser.eval('window.beforeClick = true')
await browser.eval('window.beforeClick = "abc"')
await browser.elementByCss('#broken-post').click()
await waitFor(1000)
expect(await browser.eval('window.beforeClick')).not.toBe('true')
expect(await browser.eval('window.beforeClick')).not.toBe('abc')
})

it('should always call getServerSideProps without caching', async () => {
Expand Down

0 comments on commit 49369d7

Please sign in to comment.