-
Notifications
You must be signed in to change notification settings - Fork 27k
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 fix/404-cache-control
- Loading branch information
Showing
16 changed files
with
148 additions
and
35 deletions.
There are no files selected for viewing
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 |
30 changes: 30 additions & 0 deletions
30
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,30 @@ | ||
/* eslint-env jest */ | ||
|
||
import { join } from 'path' | ||
import webdriver from 'next-webdriver' | ||
import { nextBuild, nextStart, findPort, killApp, check } from 'next-test-utils' | ||
|
||
jest.setTimeout(1000 * 60 * 1) | ||
|
||
const appDir = join(__dirname, '..') | ||
let appPort | ||
let app | ||
|
||
describe('Custom error page exception', () => { | ||
beforeAll(async () => { | ||
await nextBuild(appDir) | ||
appPort = await findPort() | ||
app = await nextStart(appDir, appPort) | ||
}) | ||
afterAll(() => killApp(app)) | ||
it('should handle errors from _error render', async () => { | ||
const navSel = '#nav' | ||
const browser = await webdriver(appPort, '/') | ||
await browser.waitForElementByCss(navSel).elementByCss(navSel).click() | ||
|
||
await check( | ||
() => browser.eval('document.documentElement.innerHTML'), | ||
/Application error: a client-side exception has occurred/ | ||
) | ||
}) | ||
}) |
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
6 changes: 1 addition & 5 deletions
6
test/integration/font-optimization/fixtures/with-google/manifest-snapshot.json
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