diff --git a/README.md b/README.md index 2353ddc..e46b071 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ will result: Path params can also be prefixed with `:` E.g. `:id` instead of `[id]` -The plugin will ignore any `.test/spec.js` files when loading routes +The plugin will ignore any `.{test|spec|bench}.js` files when loading routes ## Install diff --git a/index.ts b/index.ts index 4296c34..a4c98fb 100644 --- a/index.ts +++ b/index.ts @@ -29,7 +29,8 @@ if (typeScriptEnabled) { } const isRoute = (ext: string) => extensions.includes(ext); -const isTest = (name: string) => name.endsWith('.test') || name.endsWith('.spec'); +const isTest = (name: string) => + name.endsWith('.test') || name.endsWith('.spec') || name.endsWith('.bench'); const isDeclaration = (name: string, ext: string) => ext === '.ts' && name.endsWith('.d'); function addRequestHandler( diff --git a/test/regular-server/test-server/routes/index.bench.ts b/test/regular-server/test-server/routes/index.bench.ts new file mode 100644 index 0000000..7a11246 --- /dev/null +++ b/test/regular-server/test-server/routes/index.bench.ts @@ -0,0 +1 @@ +throw new Error('This bench file should be ignored');