diff --git a/packages/astro/test/units/vite-plugin-astro/compile.test.js b/packages/astro/test/units/vite-plugin-astro/compile.test.js index ab4fe9d3484ca..3114ed936de3a 100644 --- a/packages/astro/test/units/vite-plugin-astro/compile.test.js +++ b/packages/astro/test/units/vite-plugin-astro/compile.test.js @@ -5,12 +5,11 @@ import { init, parse } from 'es-module-lexer'; import { resolveConfig } from 'vite'; import { compileAstro } from '../../../dist/vite-plugin-astro/compile.js'; -let inlineConfig; /** * @param {string} source * @param {string} id */ -async function compile(source, id) { +async function compile(source, id, inlineConfig = {}) { const viteConfig = await resolveConfig({ configFile: false, ...inlineConfig }, 'serve'); return await compileAstro({ compileProps: { @@ -24,10 +23,6 @@ async function compile(source, id) { } describe('astro full compile', () => { - before(() => { - inlineConfig = {}; - }) - it('should compile a single file', async () => { const result = await compile(`

Hello World

`, '/src/components/index.astro'); assert.ok(result.code); @@ -86,10 +81,9 @@ using x = {} }); it('should transform the syntax by esbuild.target', async () => { - inlineConfig = { + const result = await compile(code, '/src/components/index.astro', { esbuild: { target: 'es2018' }, - } - const result = await compile(code, '/src/components/index.astro'); + }); assert.equal(result.code.includes('using x = {}'), false); }); });