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 - npm Package Compare versions

Comparing version 1.5.3 to 1.6.0

3

cli.js

@@ -16,3 +16,4 @@ 'use strict';

.option('executablePath', 'Chrome executable path', undefined, String)
.example('mocha-headless-chrome -f test.html', 'Run test on the "test.html" page')
.example('mocha-headless-chrome -f test.html', 'Run tests on the "test.html" page')
.example('mocha-headless-chrome -f http://localhost:8080', 'Run tests on the remote page')
.example('mocha-headless-chrome -f test.html -a no-sandbox -a disable-setuid-sandbox', 'Pass the Chrome arguments')

@@ -19,0 +20,0 @@ .example('mocha-headless-chrome -f test.html -r nyan', 'Output test result using "nyan" reporter');

{
"name": "mocha-headless-chrome",
"version": "1.5.3",
"version": "1.6.0",
"description": "Run client-side mocha tests in the command line through headless Chrome",

@@ -5,0 +5,0 @@ "main": "runner.js",

@@ -32,3 +32,3 @@ # mocha-headless-chrome

- **-f, --file** - Path to the page which contains tests (required)
- **-f, --file** - Path or URL of the page which contains tests (required)
- **-r, --reporter** - Mocha reporter name (defaults to "spec")

@@ -52,2 +52,8 @@ - **-o, --out** - Path to the file where test result will be saved

Run tests on the remote page:
```
$ mocha-headless-chrome -f http://localhost:8080
```
Output test results using "nyan" reporter:

@@ -54,0 +60,0 @@

@@ -130,2 +130,13 @@ 'use strict';

function prepareUrl(filePath) {
if (/^[a-zA-Z]+:\/\//.test(filePath)) {
// path is URL
return filePath;
}
// local path
let resolvedPath = path.resolve(filePath);
return `file://${resolvedPath}`;
}
module.exports = function ({ file, reporter, timeout, width, height, args, executablePath }) {

@@ -142,3 +153,3 @@ return new Promise(resolve => {

const url = path.resolve(file);
const url = prepareUrl(file);

@@ -162,3 +173,3 @@ const options = {

return page.evaluateOnNewDocument(initMocha, reporter)
.then(() => page.goto(`file://${url}`))
.then(() => page.goto(url))
.then(() => page.waitForFunction(() => window.__mochaResult__, { timeout: timeout }))

@@ -165,0 +176,0 @@ .then(() => page.evaluate(() => window.__mochaResult__))

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