Next.js Discord

Discord Forum

How do I run jest on just a specific test file when it's inside a route group.

Unanswered
American Sable posted this in #help-forum
Open in Discord
American SableOP
npm run test app/(routes)/(auth)/logout/page.tsx
bash: syntax error near unexpected token `('

Tried to escape the parentheses, but then it found no tests
npm run test app/\(routes\)/\(auth\)/logout/page.tsx

> jest --verbose app/(routes)/(auth)/logout/page.tsx

No tests found, exiting with code 1

If I just npm run test it runs the test.

More info if this helps. Maybe the regex is wrong
110 files checked.
  testMatch: **/?(*.)+(spec|test).[tj]s?(x) - 15 matches
  testPathIgnorePatterns: \\node_modules\\, \\.next\\ - 59 matches
  testRegex:  - 0 matches
Pattern: app\\(routes)\\(auth)\\logout\\page.tsx - 0 matches

0 Replies