Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@web/test-runner-chrome
Advanced tools
Browser launcher for @web/test-runner
. Looks for a locally installed instance of Chrome, and controls it using puppeteer-core. This avoids the postinstall step of puppeteer
or playwright
, speeding up installation of projects.
If you don't want to install Chrome globally, for example in a CI environment, you can use @web/test-runner-puppeeteer or @web/test-runner-playwright
See @web/test-runner for a default implementation and CLI for the test runner.
If you are using @web/test-runner, the chrome launcher is used by default. You can instantiate it yourself from the config to use on the advanced options.
If you want to customize the puppeteer launcher options, you can add the browser launcher in the config.
You can find all possible launch options in the official documentation
const { chromeLauncher } = require('@web/test-runner-chrome');
module.exports = {
browsers: [
chromeLauncher({
launchOptions: {
headless: false,
args: ['--some-flag'],
},
}),
],
};
You can use a custom function to create the puppeteer Page
. You can use this for example to set up injecting scripts for environment variables or to expose functions to the browser to control the page.
const { chromeLauncher } = require('@web/test-runner-chrome');
module.exports = {
browsers: [
chromeLauncher({
async createPage({ browser, config }) {
const page = await browser.newPage();
// expose websocket endpoint as an environment variable in the browser
page.evaluateOnNewDocument(wsEndpoint => {
window.__ENV__ = { wsEndpoint };
}, browser.wsEndpoint());
// expose a function in the browser, which calls a function on the
// puppeteer page in NodeJS
page.exposeFunction('puppeteerBringToFront', () => {
page.bringToFront();
});
return page;
},
}),
],
};
FAQs
Chrome browser launcher for Web Test Runner
The npm package @web/test-runner-chrome receives a total of 55,800 weekly downloads. As such, @web/test-runner-chrome popularity was classified as popular.
We found that @web/test-runner-chrome demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.