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.

Component Testing never finds any tests

See original GitHub issue

Current behavior

Hi!

I believe there seems to be some error with the component testing framework at the moment that is making it completely unusable. I followed all the steps in the documentation to be able to component test Vue components (in my case I am also using TypeScript), and after making several tweaks I was unable to get the runner ever to work because it can never find any test errors (see image below).

image

I have tried the following changes to fix this behaviour (neither of these have worked, still getting tests not found):

  • Removed componentFolder from cypress.json to use the default path
  • Written a JavaScript spec file instead of TypeScript
  • Written a JavaScript Vue component AND a spec file instead of using TypeScript
  • In the other company project that I found this problem, we were using path alias and project references so I thought maybe that was what was causing the issue so I stopped using the custom webpack.config.js that you can find in the repo posted below, so the plugins/index.ts just setups on('dev-server:start') with the config from the Vue CLI service, no dice

Nothing has been able to make the test runner pick up the tests within the spec files 😥

Also I have another weird problem where my default runner is Opera GX but the component runner always opens up Edge for some reason 😁

I have also noticed that someone opened the same ticket about React a few hours ago https://github.com/cypress-io/cypress/issues/16807

Desired behavior

The runner does seem to pick up the .spec.ts files I wrote in the glob expression, but it never finds the describe/it inside so it always reports that No test files were found.

Test code to reproduce

I have gone off and made a public repo that you should be able to clone and run up: https://github.com/St1fle/cypress-component-testing-error

Given all the changes I’ve done it doesn’t seem like this is something to do with my specific configuration but rather just a global problem with the framework right now but in case I am wrong and it’s something I have you can just clone the repo and run npm run test. You should see one Button.spec.ts case on the left that if you click on brings up the error. I’ve also left the example JS files that Cypress creates when it runs the first time to showcase that even for those files the component test runner fails to find tests on.

Versions

Cypress version: 7.4 Browser: Edge (although my default browser is Opera GX) Operating System: Windows CI Provider: N/A (happens locally)

Other package versions can be found within the package.json.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:12
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
jennifer-shehanecommented, Jun 4, 2021

Maybe this issue is also related? https://github.com/cypress-io/cypress/issues/16807

2reactions
jennifer-shehanecommented, Jun 4, 2021

@St1fle Thanks for reporting the issue. In your example repo, we don’t have access to install the @yottaltd/eslint-config and @yottaltd/eslint-plugin dependencies. These need to be removed in order to run npm install successfully.

The issue can be recreated after removing these deps and their references.

Screen Shot 2021-06-04 at 8 12 05 AM
Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you test for the non-existence of an element using jest ...
This is useful for asserting an element that is not present. This throws if more than one match is found (use queryAllBy instead)....
Read more >
Test Explorer intermittently never finishes finding tests
Or it's just the UI that fails to update after Visual Studio finishes to find tests? In any case: This never happened in...
Read more >
Component testing scenarios - Angular
Error: This test module uses the component BannerComponent which is using a "templateUrl" or "styleUrls", but they were never compiled.
Read more >
Component Testing FAQ | Cypress Documentation
General Questions What is component testing? Many modern front-end UI libraries encourage writing applications using small, reusable building blocks.
Read more >
Testing Components – Testing Angular
The test should better find the element by a feature that never changes and that bears no additional meaning: test ids. Test ids....
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