From 3e1fbc2c8f1f19063815580583f3765cf678b1b6 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Tue, 13 Jun 2023 22:47:24 +0800 Subject: [PATCH] Use stub image service for tests (#7376) --- .../astro-assets-prefix/astro.config.mjs | 24 +++++++++++-------- .../astro.config.mjs | 10 +++++--- .../fixtures/image-assets/astro.config.mjs | 4 ++++ .../test/fixtures/mdx-images/astro.config.ts | 8 +++++-- .../test/fixtures/image/astro.config.mjs | 8 +++++-- .../test/fixtures/redirects/astro.config.mjs | 7 ++---- 6 files changed, 39 insertions(+), 22 deletions(-) diff --git a/packages/astro/test/fixtures/astro-assets-prefix/astro.config.mjs b/packages/astro/test/fixtures/astro-assets-prefix/astro.config.mjs index 869cf811b..7393b72b8 100644 --- a/packages/astro/test/fixtures/astro-assets-prefix/astro.config.mjs +++ b/packages/astro/test/fixtures/astro-assets-prefix/astro.config.mjs @@ -1,15 +1,19 @@ import { defineConfig } from 'astro/config'; -import react from '@astrojs/react' +import react from '@astrojs/react'; +import { testImageService } from '../../test-image-service.js'; // https://astro.build/config export default defineConfig({ - // test custom base to make sure things work - base: '/custom-base', - integrations: [react()], - build: { - assetsPrefix: 'http://localhost:4321' - }, - experimental: { - assets: true - } + // test custom base to make sure things work + base: '/custom-base', + integrations: [react()], + build: { + assetsPrefix: 'http://localhost:4321', + }, + experimental: { + assets: true, + }, + image: { + service: testImageService(), + }, }); diff --git a/packages/astro/test/fixtures/content-collection-references/astro.config.mjs b/packages/astro/test/fixtures/content-collection-references/astro.config.mjs index 913ddc876..7287a1259 100644 --- a/packages/astro/test/fixtures/content-collection-references/astro.config.mjs +++ b/packages/astro/test/fixtures/content-collection-references/astro.config.mjs @@ -1,8 +1,12 @@ import { defineConfig } from 'astro/config'; +import { testImageService } from '../../test-image-service.js'; // https://astro.build/config export default defineConfig({ - experimental: { - assets: true - }, + experimental: { + assets: true, + }, + image: { + service: testImageService(), + }, }); diff --git a/packages/integrations/markdoc/test/fixtures/image-assets/astro.config.mjs b/packages/integrations/markdoc/test/fixtures/image-assets/astro.config.mjs index 9e64af363..50d395ec7 100644 --- a/packages/integrations/markdoc/test/fixtures/image-assets/astro.config.mjs +++ b/packages/integrations/markdoc/test/fixtures/image-assets/astro.config.mjs @@ -1,10 +1,14 @@ import { defineConfig } from 'astro/config'; import markdoc from '@astrojs/markdoc'; +import { testImageService } from '../../../../../astro/test/test-image-service.js'; // https://astro.build/config export default defineConfig({ experimental: { assets: true, }, + image: { + service: testImageService(), + }, integrations: [markdoc()], }); diff --git a/packages/integrations/mdx/test/fixtures/mdx-images/astro.config.ts b/packages/integrations/mdx/test/fixtures/mdx-images/astro.config.ts index fe92bd37f..30ce31bc2 100644 --- a/packages/integrations/mdx/test/fixtures/mdx-images/astro.config.ts +++ b/packages/integrations/mdx/test/fixtures/mdx-images/astro.config.ts @@ -1,8 +1,12 @@ import mdx from '@astrojs/mdx'; +import { testImageService } from '../../../../../astro/test/test-image-service.js'; export default { integrations: [mdx()], experimental: { - assets: true - } + assets: true, + }, + image: { + service: testImageService(), + }, } diff --git a/packages/integrations/vercel/test/fixtures/image/astro.config.mjs b/packages/integrations/vercel/test/fixtures/image/astro.config.mjs index a38be5065..febdb92ec 100644 --- a/packages/integrations/vercel/test/fixtures/image/astro.config.mjs +++ b/packages/integrations/vercel/test/fixtures/image/astro.config.mjs @@ -1,9 +1,13 @@ import vercel from '@astrojs/vercel/static'; import { defineConfig } from 'astro/config'; +import { testImageService } from '../../../../../astro/test/test-image-service.js'; export default defineConfig({ adapter: vercel({imageService: true}), experimental: { - assets: true - } + assets: true, + }, + image: { + service: testImageService(), + }, }); diff --git a/packages/integrations/vercel/test/fixtures/redirects/astro.config.mjs b/packages/integrations/vercel/test/fixtures/redirects/astro.config.mjs index a38be5065..6268bf916 100644 --- a/packages/integrations/vercel/test/fixtures/redirects/astro.config.mjs +++ b/packages/integrations/vercel/test/fixtures/redirects/astro.config.mjs @@ -1,9 +1,6 @@ -import vercel from '@astrojs/vercel/static'; import { defineConfig } from 'astro/config'; +import vercel from '@astrojs/vercel/static'; export default defineConfig({ - adapter: vercel({imageService: true}), - experimental: { - assets: true - } + adapter: vercel(), });