public
public copied to clipboard
Set hostname for browser runner
In Karma there is a configuration setting hostname
. Is there also such a setting in Wallaby?
I want window.location.hostname
to return localhost.example.com
instead of localhost
.
There's no such setting in wallaby at the moment.
Why would you need to make any assertions for the window.location.hostname
?
Also, does it actually work for you in karma if you set localhost.example.com
? There need to be some host mapping back to localhost for it to work anyway.
I don't want to assert window.location.hostname
but my src is depending on the value. Mocking window/location is too much work because some of the properties are readonly.
Test are passing when I set the hostname
to localhost.example.com
in the karma config.
I have a host file with localhost.example.com
(and some others) pointing to 127.0.0.1
.
Fair enough. We'll have a look into what's required to add the feature.
@fvanwijk
If you're using jest you can add a testUrl option:
"jest": {
"testURL": "http://localhost:3000/",
"setupFiles": ["<rootDir>/setup-jest.js"],
"mapCoverage": true,
"collectCoverageFrom": ["src/js/core/**/*.{js,jsx,ts,tsx}"],
"testMatch": ["**/?(*.)(spec|test).js?(x)"]
},