From 377522788cf2701c23d8739cdd29594f29c87ade Mon Sep 17 00:00:00 2001 From: Caleb Kish <4717157-calebkish@users.noreply.gitlab.com> Date: Sat, 7 Oct 2023 15:43:56 -0400 Subject: [PATCH] Fix default exlude patterns --- packages/dev-server/src/dev-server.ts | 2 +- packages/dev-server/test/e2e.test.ts | 3 +++ packages/dev-server/test/mock/worker.ts | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/dev-server/src/dev-server.ts b/packages/dev-server/src/dev-server.ts index 2de1bc6..4fca3b1 100644 --- a/packages/dev-server/src/dev-server.ts +++ b/packages/dev-server/src/dev-server.ts @@ -23,7 +23,7 @@ export type DevServerOptions = { export const defaultOptions: Required> = { entry: './src/index.ts', injectClientScript: true, - exclude: ['.*.ts', '.*.tsx', '/@.+', '/node_modules/.*'], + exclude: ['.*\\.ts', '.*\\.tsx', '/@.+', '\\/node_modules\\/.*'], } interface ExecutionContext { diff --git a/packages/dev-server/test/e2e.test.ts b/packages/dev-server/test/e2e.test.ts index e921f8b..cf761f8 100644 --- a/packages/dev-server/test/e2e.test.ts +++ b/packages/dev-server/test/e2e.test.ts @@ -41,6 +41,9 @@ test('Should exclude the file specified in the config file', async ({ page }) => let response = await page.goto('/file.ts') expect(response?.status()).toBe(404) + response = await page.goto('/ends-in-ts') + expect(response?.status()).toBe(200) + response = await page.goto('/app/foo') expect(response?.status()).toBe(404) }) diff --git a/packages/dev-server/test/mock/worker.ts b/packages/dev-server/test/mock/worker.ts index 3867c0a..ff2fb3f 100644 --- a/packages/dev-server/test/mock/worker.ts +++ b/packages/dev-server/test/mock/worker.ts @@ -19,5 +19,8 @@ app.get('/file.ts', (c) => { app.get('/app/foo', (c) => { return c.html('

exclude me!

') }) +app.get('/ends-in-ts', (c) => { + return c.text('this should not be excluded') +}) export default app