Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Electron in Travis and AppVeyor #607

Merged
merged 6 commits into from
Mar 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,41 @@ jobs:
include:
- os: linux
node_js: 8
env: [TEST_CMD=test]
env: [TEST=1]
- os: linux
node_js: 10
env: [TEST_CMD=test]
env: [TEST=1]
- os: linux
node_js: node
env: [TEST_CMD=test, BUILD_CMD=prebuild, BUILD_GROUP=linux-x64]
env: [TEST=1, TEST_ELECTRON=1, BUILD_CMD=prebuild, BUILD_GROUP=linux-x64]
addons:
apt:
packages:
- xvfb
before_script:
- export DISPLAY=':99.0'
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- os: osx
node_js: 8
env: [TEST_CMD=test]
env: [TEST=1]
- os: osx
node_js: 10
env: [TEST_CMD=test]
env: [TEST=1]
- os: osx
node_js: node
env: [TEST_CMD=test, BUILD_CMD=prebuild, BUILD_GROUP=darwin-x64]
env: [TEST=1, TEST_ELECTRON=1, BUILD_CMD=prebuild, BUILD_GROUP=darwin-x64]
- name: arm
os: linux
node_js: node
env: [BUILD_CMD=prebuild-arm, BUILD_GROUP=arm]
if: tag is present

script:
- if [[ ! -z "$TEST_CMD" ]]; then npm run $TEST_CMD; fi
- if [[ ! -z "$TEST" ]]; then npm run test; fi
- if [[ ! -z "$TEST_ELECTRON" ]]; then npm run test-electron; fi

after_success:
- if [[ ! -z "$TEST_CMD" ]]; then npm run coverage; fi
- if [[ ! -z "$TEST" ]]; then npm run coverage; fi

before_deploy:
- export ARCHIVE_NAME="${TRAVIS_TAG:-latest}-$BUILD_GROUP.tar.gz"
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ test_script:
- node --version
- npm --version
- npm test
- ps: if ($env:nodejs_version -eq "Current") { npm run test-electron }

before_deploy:
- SET ARCHIVE_NAME=%APPVEYOR_REPO_TAG_NAME%-win32-%PLATFORM%.tar.gz
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"install": "node-gyp-build",
"test": "standard && nyc tape test/*-test.js",
"test-gc": "npx -n=--expose-gc tape test/{cleanup,iterator-gc}*-test.js",
"test-electron": "electron test/electron.js",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"rebuild": "node-gyp rebuild",
"prebuild": "prebuildify -t 8.14.0 -t [email protected] --napi --strip",
Expand All @@ -33,6 +34,8 @@
"delayed": "^1.0.1",
"dependency-check": "^3.3.0",
"du": "~0.1.0",
"electron": "^4.1.2",
"glob": "^7.1.3",
"hallmark": "^0.1.0",
"level-community": "^3.0.0",
"level-concat-iterator": "^2.0.0",
Expand Down
21 changes: 21 additions & 0 deletions test/electron.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict'

const tape = require('tape')
const electron = require('electron')
const path = require('path')
const glob = require('glob')
const app = electron.app

process.on('uncaughtException', function (err) {
console.error(err)
app.exit(1)
})

app.on('ready', function () {
tape.onFinish(() => app.quit())
tape.onFailure(() => app.exit(1))

for (let file of glob.sync('test/*-test.js')) {
require(path.resolve('.', file))
}
})