Component testing without valid baseUrl
See original GitHub issueCurrent behavior
When running the integration tests, I pass the baseUrl via npm to Cypress like this:
"test": "cypress run --config baseUrl=$npm_config_host"
which allows me to do this to run the tests:
npm run test --host=http://example-host.com
When running component tests I don’t set the --host
, so npm seems to just pass $npm_config_host
to the baseUrl. This is offcourse not a valid URL, so Cypress shows this error:
Desired behavior
When running component testing, I would expect Cypress to ignore the baseUrl as it is not relevant in that case, as far as I am aware.
Test code to reproduce
I think you can use my code above to reproduce, if not let me know.
Cypress Version
10.0.3
Other
Also tried with 10.1.0.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to Fix “Cannot find a valid baseurl for repo” in CentOS
In this short article, we will show how to fix “cannot find a valid baseurl for repo” error in CentOS Linux distribution.
Read more >Configuration - Cypress Documentation
This guide is for Cypress 10 and the new JavaScript configuration file format. If you are on an older version of Cypress that...
Read more >NullInjectorError while testing - Stack Overflow
Issue 1: NullInjectorError. This error message shows as your DishComponent requires BaseURL to be injected [ @Inject ('BaseURL') ].
Read more >How to Create Better Test Coverage Using Cypress 10
Component testing handles the individual components you are testing at a particular time, to access external API it is recommended to use cy....
Read more >How to Test React Components: the Complete Guide
I found this to be true as well for React testing. ... This can also lead to people just updating the test without...
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
I tried your workaround, and it is actually better than I though! That is exactly the behavior I was looking for, thanks!
Yeah as a workaround, I just pass anything on the command line that is a valid URL.