https://github.com/shama/testron
:electric_plug: CI your client side tests with Electron
https://github.com/shama/testron
Last synced: 5 months ago
JSON representation
:electric_plug: CI your client side tests with Electron
- Host: GitHub
- URL: https://github.com/shama/testron
- Owner: shama
- Created: 2015-07-21T01:24:26.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-06-29T17:14:39.000Z (almost 7 years ago)
- Last Synced: 2024-04-25T20:44:45.690Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 71
- Watchers: 5
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-github-repos - shama/testron - :electric_plug: CI your client side tests with Electron (JavaScript)
README
# testron
CI your client side tests with Electron[](https://travis-ci.org/shama/testron)
[](https://badge.fury.io/js/testron)
[](http://github.com/hughsk/stability-badges)# about
This uses [Electron](https://github.com/atom/electron) to run tests in
[Chromium](http://www.chromium.org/).# 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`:
```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](https://www.npmjs.com/package/tape):```js
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, '
- it works
t.end()
})
```
It is recommended bundling your tests and piping to `testron`:
```json
{
"name": "my-project",
"scripts": {
"test": "browserify test/client.js | testron"
},
}
```
## travis-ci integration
Add a `.travis.yml` file to your project:
```yml
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:
```js
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](https://github.com/Jam3/hihat)
small tool for running browser tests locally
* [zuul](https://github.com/defunctzombie/zuul)
multi-framework javascript browser testing
# license
(c) 2018 Kyle Robinson Young. MIT License