testron

1.2.1 • Public • Published

testron

CI your client side tests with Electron

build status NPM version experimental

about

This uses Electron to run tests in Chromium.

usage

  • Install to your project: npm install testron --save-dev
  • Install Electron: npm install electron-prebuilt --save-dev
  • Add a test script to your package.json:
{
  "name": "my-project",
  "scripts": {
    "test": "testron test/client.js"
  },
}
  • Run npm test to run the test script in Electron

writing tests

Currently this only supports TAP. Here is an example test written using tape:

var test = require('tape')
 
test('test this', function (t) {
  t.plan(1)
  var ul = document.createElement('ul')
  var li = document.createElement('li')
  ul.appendChild(li)
  li.textContent = 'it works'
  t.equal(ul.outerHTML, '<ul><li>it works</li></ul>')
  t.end()
})

It is recommended bundling your tests and piping to testron:

{
  "name": "my-project",
  "scripts": {
    "test": "browserify test/client.js | testron"
  },
}

travis-ci integration

Add a .travis.yml file to your project:

language: node_js
node_js:
  - 'iojs'
before_script:
  - export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start

API

There is also an API:

var testron = require('testron')
var tests = testron('test/client.js')
tests.stdout.on('data', function (data) {
  console.log('line: ' + data.toString())
})
tests.on('exit', function () {
  console.log('Tests are done!')
})

similar projects

These are similar projects that also (can) use Electron for testing:

  • hihat
    small tool for running browser tests locally
  • zuul
    multi-framework javascript browser testing

license

(c) 2018 Kyle Robinson Young. MIT License

Package Sidebar

Install

npm i testron

Weekly Downloads

9

Version

1.2.1

License

MIT

Unpacked Size

5.82 kB

Total Files

7

Last publish

Collaborators

  • shama
  • bret