-
Notifications
You must be signed in to change notification settings - Fork 88
fix: ensure isr conditional 404 fix works for next 11 #1765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3e382c3
775a4cd
6b46689
836a2b4
734442c
928c6ee
f90e3bb
3402c0f
dff05b2
60de078
d7ea3fb
e4256a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Run e2e (Next 11 demo) | ||
on: | ||
pull_request: | ||
types: [opened, labeled, unlabeled, synchronize] | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'demos/next-11/**/*.{js,jsx,ts,tsx}' | ||
- 'cypress/integration/next-11/**/*.{ts,js}' | ||
- 'src/**/*.{ts,js}' | ||
jobs: | ||
cypress: | ||
name: Cypress | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
containers: [1, 2, 3, 4] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Generate Github token | ||
uses: navikt/github-app-token-generator@v1 | ||
id: get-token | ||
with: | ||
private-key: ${{ secrets.TOKENS_PRIVATE_KEY }} | ||
app-id: ${{ secrets.TOKENS_APP_ID }} | ||
|
||
- name: Checkout @netlify/wait-for-deploy-action | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: netlify/wait-for-deploy-action | ||
token: ${{ steps.get-token.outputs.token }} | ||
path: ./.github/actions/wait-for-netlify-deploy | ||
|
||
- name: Wait for Netlify Deploy | ||
id: deploy | ||
uses: ./.github/actions/wait-for-netlify-deploy | ||
with: | ||
site-name: nextjs-plugin-next-11-demo | ||
timeout: 300 | ||
|
||
- name: Deploy successful | ||
if: ${{ steps.deploy.outputs.origin-url }} | ||
run: echo ${{ steps.deploy.outputs.origin-url }} | ||
|
||
- name: Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
|
||
- run: npm install | ||
|
||
- name: Cypress run | ||
if: ${{ steps.deploy.outputs.origin-url }} | ||
id: cypress | ||
uses: cypress-io/github-action@v2 | ||
with: | ||
browser: chrome | ||
headless: true | ||
record: true | ||
parallel: true | ||
config-file: cypress/config/next-11.json | ||
group: 'Next Runtime - Next 11' | ||
spec: cypress/integration/next-11/* | ||
env: | ||
DEBUG: '@cypress/github-action' | ||
CYPRESS_baseUrl: ${{ steps.deploy.outputs.origin-url }} | ||
CYPRESS_NETLIFY_CONTEXT: ${{ steps.deploy.outputs.context }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CYPRESS_RECORD_KEY: ${{ secrets.NEXT_11_CYPRESS_RECORD_KEY }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"baseUrl": "http://localhost:3000", | ||
"integrationFolder": "cypress/integration/next-11", | ||
"projectId": "asp7p9" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
describe('ISR pages', () => { | ||
it('renders a 404 from an ISR page with TTL=60', () => { | ||
cy.request({ url: '/isr-not-found', failOnStatusCode: false }).then((res) => { | ||
expect(res.status).to.eq(404) | ||
expect(res.headers).to.have.property('x-nf-render-mode', 'odb ttl=60') | ||
}) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "next", | ||
"root": true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In case anyone else is interested in what this property does (because I didn't know offhand either), from the ESLint docs site:
@orinokai This is a bit of a nitpick, but it might be worth adding a small note here about ESLint not looking for configuration in parent directories past this point with this setting since this info is a little buried in the docs |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
netlify/functions | ||
.netlify/functions | ||
.netlify/cache |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[build] | ||
command = "next build" | ||
publish = ".next" | ||
ignore = "if [ $CACHED_COMMIT_REF == $COMMIT_REF ]; then (exit 1); else git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF ../..; fi;" | ||
|
||
[[plugins]] | ||
package = "@netlify/plugin-nextjs" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this needs to be included since
is present in the file |
||
|
||
# This is a fake plugin, that makes it run npm install | ||
[[plugins]] | ||
package = "@netlify/plugin-local-install-core" | ||
|
||
[[plugins]] | ||
package = "../plugin-wrapper" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's not many tests that are included in this suite, it's likely not worth having so many containers dedicated to this. However, I'd leave it as a
matrix
so that as we add more tests it's really easy to add containers to keep the time to run the tests low.