If I specify:
start-server-and-test start-server http://localhost:8080 test
to start the webserver automatically, I need to know the port it will be using in advance. But by default, vite will pick the first port that is available (which I consider to be a good thing)… hence I cannot know in advance the code to port to use.
I'd love start-server-and-test to automatically detect the URL/port… not sure what is the best solution for this, but maybe using a (configurable) regexp to parse the first occurence of an url like http://localhost:5176/ in stdout would be a good solution. This URL should then automatically be forwarded to the script, I guess the simplest would be using an environment variable.
See also the related microsoft/playwright#31235
If I specify:
to start the webserver automatically, I need to know the port it will be using in advance. But by default,
vitewill pick the first port that is available (which I consider to be a good thing)… hence I cannot know in advance the code to port to use.I'd love
start-server-and-testto automatically detect the URL/port… not sure what is the best solution for this, but maybe using a (configurable) regexp to parse the first occurence of an url likehttp://localhost:5176/in stdout would be a good solution. This URL should then automatically be forwarded to the script, I guess the simplest would be using an environment variable.See also the related microsoft/playwright#31235