Skip to content

Commit

Permalink
Merge pull request #36 from pacific-national/main
Browse files Browse the repository at this point in the history
Add ignoring of vitest benchmark files
  • Loading branch information
yonathan06 authored Oct 4, 2023
2 parents f3e8a78 + 6c98d83 commit 1e1af01
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions test/regular-server/test-server/routes/index.bench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
throw new Error('This bench file should be ignored');

0 comments on commit 1e1af01

Please sign in to comment.