question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No tests found when directory name has `[` or `]` (Component Testing with Next.js)

See original GitHub issue

Current behavior

Hello, I was set up Cypress Component Testing with Next.js plugin. I encountered No tests found. error.

Screen Shot 2022-03-11 at 12 53 36 Screen Shot 2022-03-11 at 12 55 21

I’m writing exactly the same code for these two files. But different behavior. I investigated below

  • some/foo.spec.js => works
  • some/[thing]/foo.spec.js => No tests found
  • some/[thing/foo.spec.js => No tests found
  • some/thing]/foo.spec.js => No tests found

[thing] style is used in Next.js pages directory. Is it possible to fix this issue? Thanks

Desired behavior

  • some/foo.spec.js => works
  • some/[thing]/foo.spec.js => works
  • some/[thing/foo.spec.js => works
  • some/thing]/foo.spec.js => works

Test code to reproduce

It can reproduce minimum Component Testing with Next.js. Just put [ or ] in directory name.

Cypress Version

9.5.1

Other

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lmiller1990commented, Mar 11, 2022

I looked into it. It’s only happening with webpack-dev-server, not vite-dev-server. So, this isn’t a Next.js specific thing, but just a webpack-dev-server thing. I will continue looking into this.

0reactions
lmiller1990commented, Mar 18, 2022

Nice, thanks for the confirmation!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Component Testing with Next.js: No tests found #17883 - GitHub
I'm having some trouble getting Component Tests setup with Next.js. Running npx cypress open-ct will open the Test Runner and identify the ...
Read more >
Testing | Next.js
Learn how to set up Next.js with three commonly used testing tools — Cypress, Playwright, Jest, and React Testing Library.
Read more >
No Test File but NextJs still display this `When testing, code ...
I am wondering where this error message is coming from. I scanned for all test-related files. **.test.tsx, **.test.js and *.spec.tsx etc.
Read more >
How to test your Next.js pages and components with Jest
One such tool is React Testing Library, an open-source tool that I'm going to walk you through setting up and using with your...
Read more >
Putting test files in the pages folder in a Next.js app
How to include test and other non-page files next to page components and API routes within the pages directory in a Next.js application....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found