Adding new test file results in "No tests found"
See original GitHub issueCurrent behavior
After installing the default cypress component testing repo and adding a new component and a new test to it results in “No tests found”
Desired behavior
It should find the tests
Test code to reproduce
Start by installing react with cypress here: https://www.cypress.io/blog/2021/04/06/cypress-component-testing-react/
Now add a new component, for example, Button.tsx
import React from 'react';
const Button = ({text}: any) => {
return <button>{text}</button>;
};
export default Button;
Now add a test to it:
import React from 'react';
import { mount } from '@cypress/react';
import Button from './Button';
it('renders button', () => {
mount(<Button text="text"/>);
cy.get('button').contains('text');
});
The result is:
Cypress Version
9.3.1
Other
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
TestExplorer does not discover new tests in existing test class
Test results are sorted by class. Adding new test methods aren't discovered and silently fail to be run. Informational data from the output...
Read more >No tests found for given includes Error, when running ...
Go to Preferences -> Build, Execution, Deployment -> Gradle -> change "Run tests using" to "IntelliJ IDEA". Run your test. Go again to...
Read more >Configure unit tests by using a .runsettings file - Microsoft Learn
In the IDE, select Test > Configure Run Settings > Select Solution Wide runsettings File, and then select the .runsettings file. This file...
Read more >Jest — Filenames without test or spec | by Damian Myerscough
No tests found, exiting with code 1. Run with `--passWithNoTests` to exit with code 0. In /Users/damianmyerscough/project1 4 files checked.
Read more >How To Test a React App with Jest and React Testing Library
Both Jest and React Testing Library come pre-packaged with Create ... Output. No tests found related to files changed since last commit.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Clearing the next cache seems to fix this issue.
If I run
rm -r .next/cache
thennpx cypress run-ct
it now detects both the new test file and the tests.Thank you @chrisrhymes, that indeed seems to do the trick!