Skip to content

Commit 343c30c

Browse files
committed
ci: run tests for edge router
1 parent 50215df commit 343c30c

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

.github/workflows/e2e-routes.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ on:
1010
- 'demos/custom-routes/**/*'
1111
- 'packages/**/*.{ts,js}'
1212
jobs:
13-
vitest:
14-
name: Vitest
13+
test:
1514
runs-on: ubuntu-latest
1615
steps:
1716
- name: Checkout
@@ -56,6 +55,6 @@ jobs:
5655

5756
- name: Run e2e tests
5857
if: ${{ steps.deploy.outputs.origin-url }}
59-
run: npm run test:e2e -- test/e2e/router
58+
run: npx jest -c test/e2e/jest.config.router.js
6059
env:
6160
SITE_URL: ${{ steps.deploy.outputs.origin-url }}

test/e2e/jest.config.router.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @ts-check
2+
/** @type {import('@jest/types').Config.InitialOptions} */
3+
4+
const parent = require('./jest.config')
5+
6+
const config = {
7+
...parent,
8+
testMatch: ['**/test/e2e/router/**/*.test.js', '**/test/e2e/router/**/*.test.ts'],
9+
}
10+
11+
module.exports = config

test/e2e/next-test-lib/next-modes/base.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ export class NextInstance {
141141
[build]
142142
command = "yarn build"
143143
publish = ".next"
144-
144+
[build.environment]
145+
NETLIFY_NEXT_EDGE_ROUTER = "true"
146+
145147
[[plugins]]
146148
package = "@netlify/plugin-nextjs"
147149
`

test/e2e/router/custom-routes.spec.ts renamed to test/e2e/router/custom-routes.test.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
1-
import { describe, it, expect, beforeAll } from 'vitest'
2-
import { check, fetchViaHTTP, getBrowserBodyText, renderViaHTTP, waitFor } from '../next-test-lib/next-test-utils'
1+
import { check, fetchViaHTTP, getBrowserBodyText, renderViaHTTP, waitFor } from 'next-test-utils'
32
import { load } from 'cheerio'
4-
import webdriver from '../next-test-lib/next-webdriver'
3+
import webdriver from 'next-webdriver'
54
const nextUrl = process.env.SITE_URL || 'http://localhost:8888'
6-
75
import url from 'url'
86

97
let buildId = 'build-id'
108

119
describe('Custom routes', () => {
12-
beforeAll(() => {
13-
process.env.HEADLESS = 'true'
14-
})
15-
1610
it('should not rewrite for _next/data route when a match is found', async () => {
1711
const initial = await fetchViaHTTP(nextUrl, '/overridden/first')
1812
expect(initial.status).toBe(200)

0 commit comments

Comments
 (0)