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 without valid baseUrl

See original GitHub issue

Current 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:

image

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:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
larsk2009commented, Jun 27, 2022

I tried your workaround, and it is actually better than I though! That is exactly the behavior I was looking for, thanks!

0reactions
larsk2009commented, Jun 27, 2022

Yeah as a workaround, I just pass anything on the command line that is a valid URL.

Read more comments on GitHub >

github_iconTop 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 >

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