browser-mocha

1.4.8 • Public • Published

browser-mocha

Build status NPM version Downloads

run browser mocha test by web driver

Installation

npm install browser-mocha

Try

try it by node demo.js, remember to open phantomjs web driver (phantomjs -w) before try

demo

Usage

basic usage

var browserMocha = require('browser-mocha')
 
browserMocha('some mocha code', {ui: 'bdd'}, function(err, data) {
    browserMocha.print(data.logs)
})

data is some of mocha runner value

  • logs array of print logs, can use browserMocha.print print to stdout
  • total count of test cases
  • failures count of failure test cases

Advanced

Test page will default add es5-shim, use {shim: false} to close it

Get script by browserMocha.getScript for custom debug

Options

Use more options like below

browserMocha('mocha code', {
      ui: 'bdd'
    , reporter: 'spec'
    , timeout: '3000' // mocha timeout
    , host: 'localhost:8910' // webdriver host, default is this
    , title: 'my test' // page test
    , shim: true // add es5-shim, default true
    , browser: {
          name: 'chrome'
        , version: '31'
        , platform: 'linux'
    }
}, callback)

License

ISC

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.4.85latest

Version History

VersionDownloads (Last 7 Days)Published
1.4.85
1.4.72
1.4.62
1.4.52
1.4.42
1.4.33
1.4.22
1.4.12
1.4.02
1.2.13
1.2.02
1.1.12
1.0.02

Package Sidebar

Install

npm i browser-mocha

Weekly Downloads

4

Version

1.4.8

License

ISC

Last publish

Collaborators

  • ftft1885