diff --git a/.gitignore b/.gitignore index 8e6d783543..d6a28ec1b1 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,8 @@ package-lock.json packages/astro/src/**/*.prebuilt.ts packages/astro/src/**/*.prebuilt-dev.ts -!packages/astro/vendor/vite/dist +packages/astro/test/units/_temp-fixtures/* +!packages/astro/test/units/_temp-fixtures/package.json packages/integrations/**/.netlify/ # exclude IntelliJ/WebStorm stuff diff --git a/biome.jsonc b/biome.jsonc index a949301439..227f37a08d 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -6,6 +6,7 @@ "**/dist/**", "**/smoke/**", "**/fixtures/**", + "**/_temp-fixtures/**", "**/vendor/**", "**/.vercel/**", ], diff --git a/package.json b/package.json index 7c2919886a..683384edf3 100644 --- a/package.json +++ b/package.json @@ -87,6 +87,9 @@ "allowAny": [ "astro" ] + }, + "patchedDependencies": { + "fs-fixture@2.4.0": "patches/fs-fixture@2.4.0.patch" } } } diff --git a/packages/astro/package.json b/packages/astro/package.json index 09e71a8309..054bc92f34 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -112,14 +112,15 @@ "build": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" --copy-wasm && tsc", "build:ci": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" --copy-wasm", "dev": "astro-scripts dev --copy-wasm --prebuild \"src/runtime/server/astro-island.ts\" --prebuild \"src/runtime/client/{idle,load,media,only,visible}.ts\" \"src/**/*.{ts,js}\"", - "test": "pnpm run test:node && pnpm run test:types", - "test:match": "pnpm run test:node --match", + "test": "pnpm run test:unit && pnpm run test:integration && pnpm run test:types", + "test:match": "astro-scripts test \"test/**/*.test.js\" --match", "test:e2e": "pnpm test:e2e:chrome && pnpm test:e2e:firefox", "test:e2e:match": "playwright test -g", "test:e2e:chrome": "playwright test", "test:e2e:firefox": "playwright test --config playwright.firefox.config.js", "test:types": "tsc --project tsconfig.tests.json", - "test:node": "astro-scripts test \"test/**/*.test.js\"" + "test:unit": "astro-scripts test \"test/units/**/*.test.js\" --teardown ./test/units/teardown.js", + "test:integration": "astro-scripts test \"test/*.test.js\"" }, "dependencies": { "@astrojs/compiler": "^2.10.3", @@ -210,9 +211,9 @@ "eol": "^0.10.0", "execa": "^8.0.1", "expect-type": "^1.1.0", + "fs-fixture": "^2.4.0", "mdast-util-mdx": "^3.0.0", "mdast-util-mdx-jsx": "^3.1.3", - "memfs": "^4.14.0", "node-mocks-http": "^1.16.1", "parse-srcset": "^1.0.2", "rehype-autolink-headings": "^7.1.0", diff --git a/packages/astro/src/vite-plugin-astro-server/plugin.ts b/packages/astro/src/vite-plugin-astro-server/plugin.ts index 3b75a3843e..55f12216dc 100644 --- a/packages/astro/src/vite-plugin-astro-server/plugin.ts +++ b/packages/astro/src/vite-plugin-astro-server/plugin.ts @@ -77,6 +77,9 @@ export default function createVitePluginAstroServer({ } process.on('unhandledRejection', handleUnhandledRejection); + viteServer.httpServer?.on('close', () => { + process.off('unhandledRejection', handleUnhandledRejection); + }); return () => { // Push this middleware to the front of the stack so that it can intercept responses. diff --git a/packages/astro/test/fixtures/content-mixed-errors/astro.config.mjs b/packages/astro/test/fixtures/content-mixed-errors/astro.config.mjs deleted file mode 100644 index 882e6515a6..0000000000 --- a/packages/astro/test/fixtures/content-mixed-errors/astro.config.mjs +++ /dev/null @@ -1,4 +0,0 @@ -import { defineConfig } from 'astro/config'; - -// https://astro.build/config -export default defineConfig({}); diff --git a/packages/astro/test/fixtures/content-mixed-errors/package.json b/packages/astro/test/fixtures/content-mixed-errors/package.json deleted file mode 100644 index d90bfabda5..0000000000 --- a/packages/astro/test/fixtures/content-mixed-errors/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "@test/content-mixed-errors", - "type": "module", - "version": "0.0.1", - "private": true, - "scripts": { - "dev": "astro dev", - "start": "astro dev", - "build": "astro build", - "preview": "astro preview", - "astro": "astro" - }, - "dependencies": { - "astro": "workspace:*" - } -} diff --git a/packages/astro/test/fixtures/content-mixed-errors/src/content/authors/placeholder.json b/packages/astro/test/fixtures/content-mixed-errors/src/content/authors/placeholder.json deleted file mode 100644 index 64ae1c04c5..0000000000 --- a/packages/astro/test/fixtures/content-mixed-errors/src/content/authors/placeholder.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "Placeholder" -} diff --git a/packages/astro/test/fixtures/content-mixed-errors/src/content/blog/placeholder.md b/packages/astro/test/fixtures/content-mixed-errors/src/content/blog/placeholder.md deleted file mode 100644 index f7f65691b4..0000000000 --- a/packages/astro/test/fixtures/content-mixed-errors/src/content/blog/placeholder.md +++ /dev/null @@ -1,3 +0,0 @@ ---- -title: Placeholder post ---- diff --git a/packages/astro/test/fixtures/content-mixed-errors/src/pages/authors.astro b/packages/astro/test/fixtures/content-mixed-errors/src/pages/authors.astro deleted file mode 100644 index 8352a3d27d..0000000000 --- a/packages/astro/test/fixtures/content-mixed-errors/src/pages/authors.astro +++ /dev/null @@ -1,10 +0,0 @@ ---- -import { getCollection } from 'astro:content'; -try { - await getCollection('authors') -} catch (e) { - return e -} ---- - -