Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@dxos/browser-runner

Package Overview
Dependencies
Maintainers
13
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dxos/browser-runner

CLI to run JavaScript files into a headless browser.

latest
Source
npmnpm
Version
1.0.0-beta.13
Version published
Weekly downloads
36
71.43%
Maintainers
13
Weekly downloads
 
Created
Source

@dxos/browser-runner

CLI to run JavaScript files into a headless browser.

Build Status Coverage Status js-semistandard-style standard-readme compliant

Install

$ npm install -g @dxos/browser-runner

Usage

$ browser-runner --help

cli.js <file> [options] [puppeteerOptions]

runs the script

Positionals:
  file  the file to run                                                 [string]

Options:
  --help        Show help                                              [boolean]
  --version     Show version number                                    [boolean]
  --config, -c  webpack config                                          [string]
  --watch, -w   watch                                                  [boolean]
  --port, -p    port to run                                             [number]
  --env         env file                                                [string]

Testing in Chrome

$ browser-runner script.js

Testing in Firefox (experimental)

You can test with Firefox using the puppeteer option product.

$ browser-runner script.js --product firefox

Important: First time the execution will take longer since it has to download the firefox browser.

Process exit

browser-runner cannot know when your script finish the execution.

If you want to exit the process at some point in your script runs:

process.exit(code) // 0 success 1 error

Or throw an unhandled Error

Environment variables

Your script can use environment variables from the shell or a .env file.

// script.js

console.log(process.env.NODE_ENV) // development
console.log(process.env.SOME_VARIABLE) // foo
$ NODE_ENV=development SOME_VARIABLE=foo browser-runner scripts.js

Contributing

PRs accepted.

License

GPL-3.0 © dxos

FAQs

Package last updated on 14 Jul 2020

Did you know?

Socket

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.

Install

Related posts