mirror of
https://github.com/withastro/astro.git
synced 2025-03-10 23:01:26 -05:00
test: add setup for Vercel / Netlify tests (#7716)
Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
This commit is contained in:
parent
8dbbc46e64
commit
54bb6d8546
8 changed files with 48 additions and 1 deletions
|
@ -47,7 +47,8 @@
|
|||
"build": "astro-scripts build \"src/**/*.ts\" && tsc",
|
||||
"build:ci": "astro-scripts build \"src/**/*.ts\"",
|
||||
"dev": "astro-scripts dev \"src/**/*.ts\"",
|
||||
"test": "mocha --exit --timeout 20000 --file \"./test/setup.js\" test/"
|
||||
"test": "mocha --exit --timeout 20000 --file \"./test/setup.js\" test/ --ignore test/hosted",
|
||||
"test:hosted": "mocha --exit --timeout 30000 test/hosted"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/internal-helpers": "^0.1.1",
|
||||
|
|
3
packages/integrations/vercel/test/hosted/README.md
Normal file
3
packages/integrations/vercel/test/hosted/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
The tests in this folder are done directly on a deployed Vercel website (hosted at https://astro-vercel-image-test.vercel.app) and are not run by the test suite. They instead run every week through a GitHub action.
|
||||
|
||||
The purpose of those tests is to make sure that everything works as expected while deployed. In a way, they're as E2E as it gets.
|
|
@ -0,0 +1,11 @@
|
|||
import vercel from '@astrojs/vercel/serverless';
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
output: 'server',
|
||||
adapter: vercel(),
|
||||
experimental: {
|
||||
assets: true,
|
||||
},
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"name": "vercel-hosted-astro-project",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "astro build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/vercel": "file:../../..",
|
||||
"astro": "file:../../../../../astro"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 9.3 MiB |
1
packages/integrations/vercel/test/hosted/hosted-astro-project/src/env.d.ts
vendored
Normal file
1
packages/integrations/vercel/test/hosted/hosted-astro-project/src/env.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/// <reference types="astro/client-image" />
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
import { Image } from 'astro:assets';
|
||||
import penguin from '../assets/penguin.png';
|
||||
---
|
||||
|
||||
<Image src={penguin} width={300} alt="" />
|
13
packages/integrations/vercel/test/hosted/hosted.test.js
Normal file
13
packages/integrations/vercel/test/hosted/hosted.test.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { expect } from 'chai';
|
||||
|
||||
const VERCEL_TEST_URL = 'https://astro-vercel-image-test.vercel.app';
|
||||
|
||||
describe('Hosted Vercel Tests', () => {
|
||||
it('Image endpoint works', async () => {
|
||||
const image = await fetch(
|
||||
VERCEL_TEST_URL + '/_image?href=%2F_astro%2Fpenguin.e9c64733.png&w=300&f=webp'
|
||||
);
|
||||
|
||||
expect(image.status).to.equal(200);
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue