Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4345795

Browse files
committed
test: add a case for interop with oher build plugins / integrations
1 parent 7e2b9e1 commit 4345795

20 files changed

+197
-0
lines changed

‎tests/e2e/with-integrations.test.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { expect } from '@playwright/test'
2+
import { test } from '../utils/playwright-helpers.js'
3+
4+
test('Renders the Home page correctly', async ({ page, withIntegrations }) => {
5+
await page.goto(withIntegrations.url)
6+
7+
expect(page.locator('body')).toHaveText('Hello World')
8+
})
9+
10+
test.describe('Should clear stale functions produced by previous builds by @netlify/plugin-nextjs', () => {
11+
test('Serverless functions', async ({ page, withIntegrations }) => {
12+
const response1 = await page.goto(new URL('/test/serverless/v4', withIntegrations.url).href)
13+
expect(response1?.status()).toBe(404)
14+
15+
const response2 = await page.goto(new URL('/test/serverless/v5', withIntegrations.url).href)
16+
expect(response2?.status()).toBe(404)
17+
})
18+
19+
test('Edge functions', async ({ page, withIntegrations }) => {
20+
const response1 = await page.goto(new URL('/test/edge/v4', withIntegrations.url).href)
21+
expect(response1?.status()).toBe(404)
22+
23+
const response2 = await page.goto(new URL('/test/edge/v5', withIntegrations.url).href)
24+
expect(response2?.status()).toBe(404)
25+
})
26+
})
27+
28+
test.describe('Should keep functions produced by other build plugins', () => {
29+
test('Serverless functions', async ({ page, withIntegrations }) => {
30+
const response1 = await page.goto(
31+
new URL('/test/serverless/integration-with-json-config', withIntegrations.url).href,
32+
)
33+
expect(response1?.status()).toBe(200)
34+
expect(await response1?.text()).toBe('Hello from /test/serverless/integration-with-json-config')
35+
36+
const response2 = await page.goto(
37+
new URL('/test/serverless/integration-with-json-config', withIntegrations.url).href,
38+
)
39+
expect(response2?.status()).toBe(200)
40+
expect(await response2?.text()).toBe('Hello from /test/serverless/integration-with-json-config')
41+
})
42+
43+
test('Edge functions', async ({ page, withIntegrations }) => {
44+
const response1 = await page.goto(
45+
new URL('/test/edge/integration-in-manifest', withIntegrations.url).href,
46+
)
47+
expect(response1?.status()).toBe(200)
48+
expect(await response1?.text()).toBe('Hello from /test/edge/integration-in-manifest')
49+
50+
const response2 = await page.goto(
51+
new URL('/test/edge/integration-not-in-manifest', withIntegrations.url).href,
52+
)
53+
expect(response2?.status()).toBe(200)
54+
expect(await response2?.text()).toBe('Hello from /test/edge/integration-not-in-manifest')
55+
})
56+
})
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[[plugins]]
2+
package = "/plugins/create-other-functions"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
eslint: {
4+
ignoreDuringBuilds: true,
5+
},
6+
}
7+
8+
module.exports = nextConfig
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "with-integrations",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"build": "next build"
7+
},
8+
"dependencies": {
9+
"next": "latest",
10+
"react": "18.2.0",
11+
"react-dom": "18.2.0"
12+
}
13+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default function Home() {
2+
return (
3+
<main>
4+
<h1>Hello World</h1>
5+
</main>
6+
)
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function handler() {
2+
return new Response('Hello from /test/edge/integration-in-manifest', { status: 200 })
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default function handler() {
2+
return new Response('Hello from /test/edge/integration-not-in-manifest', { status: 200 })
3+
}
4+
5+
export const config = {
6+
path: '/test/edge/integration-not-in-manifest',
7+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"functions": [
3+
{
4+
"function": "next-runtime-v4",
5+
"name": "next-runtime-v4",
6+
"path": "/test/edge/v4",
7+
"generator": "@netlify/plugin-nextjs@4.41.3"
8+
},
9+
{
10+
"function": "next-runtime-v5",
11+
"name": "next-runtime-v5",
12+
"path": "/test/edge/v5",
13+
"generator": "@netlify/plugin-nextjs@5.3.3"
14+
},
15+
{
16+
"function": "integration-in-manifest",
17+
"name": "integration-in-manifest",
18+
"path": "/test/edge/integration-in-manifest",
19+
"generator": "@netlify/some-integration@1.0.0"
20+
}
21+
],
22+
"layers": [],
23+
"version": 1
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default function handler() {
2+
return new Response('Hello from edge functions generated by @netlify/plugin-nextjs@4', {
3+
status: 200,
4+
})
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default function handler() {
2+
return new Response('Hello from edge functions generated by @netlify/plugin-nextjs@5', {
3+
status: 200,
4+
})
5+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /