Open valentinpalkovic opened 1 day ago
True, it was added specifically for that. In the next patch, the option will be deprecated and instead, Vitest will use transformIndexHtml
(see https://github.com/vitest-dev/vitest/pull/6725), so the fix for the future is to inject it in the plugin.
Describe the bug
I am trying to follow the example provided on the Vitest homepage for browser.testerScripts:
According to the documentation, browser.testerScripts is a custom script injection feature for the browser environment. The script source and content should be processed by Vite plugins, and this feature seems ideal for injecting polyfills or external libraries required for certain browser tests.
However, when I attempt to inject an external script (in this case, jQuery), the URL is transformed to:
This results in a failed request with a 404 error, as the transformation to the local server address is incorrect for external URLs.
Expected behaviour: External URLs provided in browser.testerScripts should not be transformed by Vite or should be handled correctly so that the script can be loaded and injected into the browser test environment.
Reproduction
System Info
Used Package Manager
pnpm
Validations