-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' into vary-accept
- Loading branch information
Showing
16 changed files
with
141 additions
and
28 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Learn how to add code owners here: | ||
# https://help.github.com/en/articles/about-code-owners | ||
|
||
* @timneutkens @ijjk @lfades @divmain @shuding | ||
/docs/ @timneutkens @ijjk @lfades @divmain @shuding @leerob | ||
/examples/ @timneutkens @ijjk @lfades @divmain @shuding @leerob | ||
* @timneutkens @ijjk @shuding @styfle @huozhi @padmaia | ||
/docs/ @timneutkens @ijjk @shuding @styfle @huozhi @padmaia @leerob @lfades | ||
/examples/ @timneutkens @ijjk @shuding @styfle @huozhi @padmaia @leerob @lfades |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
START_DIR=$PWD | ||
# gets last argument which should be the project dir | ||
for PROJECT_DIR in $@;do :;done | ||
|
||
if [ -z $PROJECT_DIR ];then | ||
echo "No project directory provided, exiting..." | ||
exit 1; | ||
fi; | ||
|
||
if [ ! -d $PROJECT_DIR ];then | ||
echo "Invalid project directory provided, exiting..." | ||
exit 1; | ||
fi; | ||
|
||
if [ $PROJECT_DIR == $PWD ] || [ "$PROJECT_DIR" == "." ];then | ||
echo "Project directory can not be root, exiting..." | ||
exit 1; | ||
fi; | ||
|
||
CONFLICTING_DEPS=("react" "react-dom" "styled-jsx" "next") | ||
|
||
for dep in ${CONFLICTING_DEPS[@]};do | ||
if [ -d "$PROJECT_DIR/node_modules/$dep" ];then | ||
HAS_CONFLICTING_DEP="yup" | ||
fi; | ||
done | ||
|
||
if [ ! -z $HAS_CONFLICTING_DEP ] || [ ! -d "$PROJECT_DIR/node_modules" ];then | ||
cd $PROJECT_DIR | ||
yarn install | ||
for dep in ${CONFLICTING_DEPS[@]};do | ||
rm -rf node_modules/$dep | ||
done | ||
fi | ||
|
||
cd $START_DIR | ||
yarn next $@ |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
test/integration/custom-error-page-exception/pages/_error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* eslint-disable no-unused-expressions, no-undef */ | ||
let renderCount = 0 | ||
|
||
export default function Error() { | ||
renderCount++ | ||
|
||
// Guard to avoid endless loop crashing the browser tab. | ||
if (typeof window !== 'undefined' && renderCount < 3) { | ||
throw new Error('crash') | ||
} | ||
return `error threw ${renderCount} times` | ||
} |
20 changes: 20 additions & 0 deletions
20
test/integration/custom-error-page-exception/pages/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* eslint-disable no-unused-expressions, no-unused-vars */ | ||
import React from 'react' | ||
import Link from 'next/link' | ||
|
||
function page() { | ||
return ( | ||
<Link href="/"> | ||
<a id="nav">Client side nav</a> | ||
</Link> | ||
) | ||
} | ||
|
||
page.getInitialProps = () => { | ||
if (typeof window !== 'undefined') { | ||
throw new Error('Oops from Home') | ||
} | ||
return {} | ||
} | ||
|
||
export default page |
26 changes: 26 additions & 0 deletions
26
test/integration/custom-error-page-exception/test/index.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* eslint-env jest */ | ||
|
||
import { join } from 'path' | ||
import webdriver from 'next-webdriver' | ||
import { nextBuild, nextStart, findPort, killApp } from 'next-test-utils' | ||
|
||
jest.setTimeout(1000 * 60 * 1) | ||
|
||
const appDir = join(__dirname, '..') | ||
const navSel = '#nav' | ||
const errorMessage = 'Application error: a client-side exception has occurred' | ||
|
||
describe('Custom error page exception', () => { | ||
it('should handle errors from _error render', async () => { | ||
const { code } = await nextBuild(appDir) | ||
const appPort = await findPort() | ||
const app = await nextStart(appDir, appPort) | ||
const browser = await webdriver(appPort, '/') | ||
await browser.waitForElementByCss(navSel).elementByCss(navSel).click() | ||
const text = await (await browser.elementByCss('#__next')).text() | ||
killApp(app) | ||
|
||
expect(code).toBe(0) | ||
expect(text).toMatch(errorMessage) | ||
}) | ||
}) |