Socket
Socket
Sign inDemoInstall

mocha-headless-chrome

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mocha-headless-chrome

Run client-side mocha tests in the command line through headless Chrome


Version published
Weekly downloads
3.9K
increased by13.6%
Maintainers
1
Weekly downloads
 
Created
Source

mocha-headless-chrome

This is the tool which runs client-side mocha tests in the command line through headless Chrome (puppeteer is used).

All mocha reporters are supported (including third-party reporters).

Getting Started

First you'll need to install mocha-headless-chrome:

npm i mocha-headless-chrome

Then prepare the test page (see the example).

  • Add the <meta charset="utf-8"> meta tag. Otherwise browser may use another encoding and test results will be shown incorrectly.
  • Include mocha js & styles into the page. Also add the container for mocha info <div id="mocha"></div>.
  • Include your testable code and tests.
  • Use window.runMochaHeadlessChrome() function instead mocha.run() if it is available.

Then run mocha-headless-chrome CLI and specify your test page path using -f parameter.

mocha-headless-chrome -f test-page.html

Options

  • -f, --file - Path to the page which contains tests (required)
  • -r, --reporter [value] - Mocha reporter name (defaults to "spec")
  • -t, --timeout - Timeout in ms (defaults to 60000)
  • -h, --help - Output usage information
  • -v, --version - Output the version number

Keywords

FAQs

Package last updated on 27 Aug 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc