diff --git a/tests/integration/130.eleventy.test.cjs b/tests/integration/130.eleventy.test.cjs
deleted file mode 100644
index de160ff0f4a..00000000000
--- a/tests/integration/130.eleventy.test.cjs
+++ /dev/null
@@ -1,145 +0,0 @@
-const { Buffer } = require('buffer')
-const path = require('path')
-
-const test = require('ava')
-
-const { clientIP, originalIP } = require('../lib/local-ip.cjs')
-
-const { startDevServer } = require('./utils/dev-server.cjs')
-const got = require('./utils/got.cjs')
-
-test.before(async (t) => {
- const server = await startDevServer({ cwd: path.join(__dirname, '__fixtures__/eleventy-site') })
-
- t.context.server = server
-})
-
-test.after(async (t) => {
- const { server } = t.context
- await server.close()
-})
-
-test('homepage', async (t) => {
- const { url } = t.context.server
- const response = await got(`${url}/`).text()
-
- t.true(response.includes('Eleventy Site'))
-})
-
-test('redirect test', async (t) => {
- const { url } = t.context.server
- const { body, headers, statusCode } = await got(`${url}/something`, { followRedirect: false })
-
- t.is(statusCode, 301)
- t.is(headers.location, `/otherthing`)
- t.is(body, 'Redirecting to /otherthing')
-})
-
-// TODO: un-skip this once https://github.com/netlify/cli/issues/1242 is fixed
-test.skip('normal rewrite', async (t) => {
- const { url } = t.context.server
- const { body, headers, statusCode } = await got(`${url}/doesnt-exist`)
-
- t.is(statusCode, 200)
- t.true(headers['content-type'].startsWith('text/html'))
- t.true(body.includes('Eleventy Site'))
-})
-
-test('force rewrite', async (t) => {
- const { url } = t.context.server
- const { body, headers, statusCode } = await got(`${url}/force`)
-
- t.is(statusCode, 200)
- t.true(headers['content-type'].startsWith('text/html'))
- t.true(body.includes('
Test content
'))
-})
-
-test('functions rewrite echo without body', async (t) => {
- const { host, port, url } = t.context.server
- const response = await got(`${url}/api/echo?ding=dong`).json()
- const { 'x-nf-request-id': requestID, ...headers } = response.headers
-
- t.is(response.body, undefined)
- t.deepEqual(headers, {
- accept: 'application/json',
- 'accept-encoding': 'gzip, deflate, br',
- 'client-ip': clientIP,
- connection: 'close',
- host: `${host}:${port}`,
- 'user-agent': 'got (https://github.com/sindresorhus/got)',
- 'x-forwarded-for': originalIP,
- 'x-nf-account-id': '',
- 'x-nf-client-connection-ip': clientIP,
- 'x-nf-geo': Buffer.from(
- '{"city":"San Francisco","country":{"code":"US","name":"United States"},"subdivision":{"code":"CA","name":"California"},"longitude":0,"latitude":0,"timezone":"UTC"}',
- ).toString('base64'),
- })
- t.is(requestID.length, 26)
- t.is(response.httpMethod, 'GET')
- t.is(response.isBase64Encoded, true)
- t.is(response.path, '/api/echo')
- t.deepEqual(response.queryStringParameters, { ding: 'dong' })
-})
-
-test('functions rewrite echo with body', async (t) => {
- const { host, port, url } = t.context.server
- const response = await got
- .post(`${url}/api/echo?ding=dong`, {
- headers: {
- 'content-type': 'application/x-www-form-urlencoded',
- },
- body: 'some=thing',
- })
- .json()
- const { 'x-nf-request-id': requestID, ...headers } = response.headers
-
- t.is(response.body, 'some=thing')
- t.deepEqual(headers, {
- accept: 'application/json',
- 'accept-encoding': 'gzip, deflate, br',
- 'client-ip': clientIP,
- connection: 'close',
- host: `${host}:${port}`,
- 'content-type': 'application/x-www-form-urlencoded',
- 'content-length': '10',
- 'user-agent': 'got (https://github.com/sindresorhus/got)',
- 'x-forwarded-for': originalIP,
- 'x-nf-account-id': '',
- 'x-nf-client-connection-ip': clientIP,
- 'x-nf-geo': Buffer.from(
- '{"city":"San Francisco","country":{"code":"US","name":"United States"},"subdivision":{"code":"CA","name":"California"},"longitude":0,"latitude":0,"timezone":"UTC"}',
- ).toString('base64'),
- })
- t.is(requestID.length, 26)
- t.is(response.httpMethod, 'POST')
- t.is(response.isBase64Encoded, false)
- t.is(response.path, '/api/echo')
- t.deepEqual(response.queryStringParameters, { ding: 'dong' })
-})
-
-test('functions echo with multiple query params', async (t) => {
- const { host, port, url } = t.context.server
- const response = await got(`${url}/.netlify/functions/echo?category=a&category=b`).json()
- const { 'x-nf-request-id': requestID, ...headers } = response.headers
-
- t.deepEqual(headers, {
- accept: 'application/json',
- 'accept-encoding': 'gzip, deflate, br',
- 'client-ip': clientIP,
- connection: 'close',
- host: `${host}:${port}`,
- 'user-agent': 'got (https://github.com/sindresorhus/got)',
- 'x-forwarded-for': originalIP,
- 'x-nf-account-id': '',
- 'x-nf-client-connection-ip': clientIP,
- 'x-nf-geo': Buffer.from(
- '{"city":"San Francisco","country":{"code":"US","name":"United States"},"subdivision":{"code":"CA","name":"California"},"longitude":0,"latitude":0,"timezone":"UTC"}',
- ).toString('base64'),
- })
- t.is(requestID.length, 26)
- t.is(response.httpMethod, 'GET')
- t.is(response.isBase64Encoded, true)
- t.is(response.path, '/.netlify/functions/echo')
- t.deepEqual(response.queryStringParameters, { category: 'a, b' })
- t.deepEqual(response.multiValueQueryStringParameters, { category: ['a', 'b'] })
-})
diff --git a/tests/integration/frameworks/eleventy.test.mjs b/tests/integration/frameworks/eleventy.test.mjs
new file mode 100644
index 00000000000..0157e7890ff
--- /dev/null
+++ b/tests/integration/frameworks/eleventy.test.mjs
@@ -0,0 +1,166 @@
+import { Buffer } from 'buffer'
+import path from 'path'
+import { fileURLToPath } from 'url'
+
+import fetch from 'node-fetch'
+import { afterAll, beforeAll, describe, test } from 'vitest'
+
+import { clientIP, originalIP } from '../../lib/local-ip.cjs'
+import { startDevServer } from '../utils/dev-server.cjs'
+
+// eslint-disable-next-line no-underscore-dangle
+const __dirname = path.dirname(fileURLToPath(import.meta.url))
+
+const context = {}
+
+beforeAll(async () => {
+ const server = await startDevServer({ cwd: path.join(__dirname, '../__fixtures__/eleventy-site') })
+
+ context.server = server
+})
+
+afterAll(async () => {
+ const { server } = context
+ await server.close()
+})
+
+describe.concurrent('eleventy', () => {
+ test('homepage', async (t) => {
+ const { url } = context.server
+ const response = await fetch(`${url}/`).then((res) => res.text())
+
+ t.expect(response.includes('Eleventy Site')).toBe(true)
+ })
+
+ test('redirect test', async (t) => {
+ const { url } = context.server
+ const response = await fetch(`${url}/something`, {
+ redirect: 'manual',
+ })
+ const { headers, status } = response
+
+ t.expect(status).toBe(301)
+ t.expect(headers.get('location').endsWith('/otherthing')).toBe(true)
+ t.expect(await response.text()).toEqual('Redirecting to /otherthing')
+ })
+
+ test('normal rewrite', async (t) => {
+ const { url } = context.server
+ const response = await fetch(`${url}/doesnt-exist`)
+ const { headers, status } = response
+ const body = await response.text()
+
+ t.expect(status).toBe(200)
+ t.expect(headers.get('content-type').startsWith('text/html')).toBe(true)
+ t.expect(body.includes('Eleventy Site')).toBe(true)
+ })
+
+ test('force rewrite', async (t) => {
+ const { url } = context.server
+ const response = await fetch(`${url}/force`)
+ const { headers, status } = response
+ const body = await response.text()
+
+ t.expect(status).toBe(200)
+ t.expect(headers.get('content-type').startsWith('text/html')).toBe(true)
+ t.expect(body.includes('Test content
')).toBe(true)
+ })
+
+ test('functions rewrite echo without body', async (t) => {
+ const { host, port, url } = context.server
+ const jsonResponse = await fetch(`${url}/api/echo?ding=dong`, {
+ headers: { accept: 'application/json', 'accept-encoding': 'gzip, deflate, br' },
+ }).then((res) => res.json())
+ const { 'x-nf-request-id': requestID, ...headers } = jsonResponse.headers
+
+ t.expect(jsonResponse.body).toBe(undefined)
+ t.expect(headers).toStrictEqual({
+ accept: 'application/json',
+ 'accept-encoding': 'gzip, deflate, br',
+ 'client-ip': clientIP,
+ connection: 'close',
+ host: `${host}:${port}`,
+ 'user-agent': 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)',
+ 'x-forwarded-for': originalIP,
+ 'x-nf-account-id': '',
+ 'x-nf-client-connection-ip': clientIP,
+ 'x-nf-geo': Buffer.from(
+ '{"city":"San Francisco","country":{"code":"US","name":"United States"},"subdivision":{"code":"CA","name":"California"},"longitude":0,"latitude":0,"timezone":"UTC"}',
+ ).toString('base64'),
+ })
+ t.expect(requestID.length).toBe(26)
+ t.expect(jsonResponse.httpMethod).toEqual('GET')
+ t.expect(jsonResponse.isBase64Encoded).toBe(true)
+ t.expect(jsonResponse.path).toEqual('/api/echo')
+ t.expect(jsonResponse.queryStringParameters).toStrictEqual({ ding: 'dong' })
+ })
+
+ test('functions rewrite echo with body', async (t) => {
+ const { host, port, url } = context.server
+ const response = await fetch(`${url}/api/echo?ding=dong`, {
+ method: 'POST',
+ headers: {
+ accept: 'application/json',
+ 'accept-encoding': 'gzip, deflate, br',
+ 'content-type': 'application/x-www-form-urlencoded',
+ },
+ body: 'some=thing',
+ }).then((res) => res.json())
+ const { 'x-nf-request-id': requestID, ...headers } = response.headers
+
+ t.expect(response.body).toEqual('some=thing')
+ t.expect(headers).toStrictEqual({
+ accept: 'application/json',
+ 'accept-encoding': 'gzip, deflate, br',
+ 'client-ip': clientIP,
+ connection: 'close',
+ host: `${host}:${port}`,
+ 'content-type': 'application/x-www-form-urlencoded',
+ 'content-length': '10',
+ 'user-agent': 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)',
+ 'x-forwarded-for': originalIP,
+ 'x-nf-account-id': '',
+ 'x-nf-client-connection-ip': clientIP,
+ 'x-nf-geo': Buffer.from(
+ '{"city":"San Francisco","country":{"code":"US","name":"United States"},"subdivision":{"code":"CA","name":"California"},"longitude":0,"latitude":0,"timezone":"UTC"}',
+ ).toString('base64'),
+ })
+ t.expect(requestID.length).toBe(26)
+ t.expect(response.httpMethod).toEqual('POST')
+ t.expect(response.isBase64Encoded).toBe(false)
+ t.expect(response.path).toEqual('/api/echo')
+ t.expect(response.queryStringParameters).toStrictEqual({ ding: 'dong' })
+ })
+
+ test('functions echo with multiple query params', async (t) => {
+ const { host, port, url } = context.server
+ const response = await fetch(`${url}/.netlify/functions/echo?category=a&category=b`, {
+ headers: {
+ accept: 'application/json',
+ 'accept-encoding': 'gzip, deflate, br',
+ },
+ }).then((res) => res.json())
+ const { 'x-nf-request-id': requestID, ...headers } = response.headers
+
+ t.expect(headers).toStrictEqual({
+ accept: 'application/json',
+ 'accept-encoding': 'gzip, deflate, br',
+ 'client-ip': clientIP,
+ connection: 'close',
+ host: `${host}:${port}`,
+ 'user-agent': 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)',
+ 'x-forwarded-for': originalIP,
+ 'x-nf-account-id': '',
+ 'x-nf-client-connection-ip': clientIP,
+ 'x-nf-geo': Buffer.from(
+ '{"city":"San Francisco","country":{"code":"US","name":"United States"},"subdivision":{"code":"CA","name":"California"},"longitude":0,"latitude":0,"timezone":"UTC"}',
+ ).toString('base64'),
+ })
+ t.expect(requestID.length).toBe(26)
+ t.expect(response.httpMethod).toEqual('GET')
+ t.expect(response.isBase64Encoded).toBe(true)
+ t.expect(response.path).toEqual('/.netlify/functions/echo')
+ t.expect(response.queryStringParameters).toStrictEqual({ category: 'a, b' })
+ t.expect(response.multiValueQueryStringParameters).toStrictEqual({ category: ['a', 'b'] })
+ })
+})