Skip to content

Commit 522a5f6

Browse files
committed
Set up Travis CI configuration
1 parent cb30183 commit 522a5f6

File tree

5 files changed

+73
-1
lines changed

5 files changed

+73
-1
lines changed

.travis.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
os:
2+
- linux
3+
- osx
4+
5+
language: node_js
6+
7+
node_js:
8+
- "node"
9+
10+
before_script: ./script/ci
11+
12+
sudo: false
13+
14+
install:
15+
- npm install
16+
17+
cache:
18+
directories:
19+
- node_modules
20+
21+
notifications:
22+
email:
23+
on_success: never
24+
on_failure: change

package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"start-hot": "HOT=1 NODE_ENV=development electron .",
1313
"package": "node package.js --name=GraphiQL",
1414
"package-all": "node package.js --name=GraphiQL --all",
15-
"release": "node node_modules/electron-release/cli --app release/darwin-x64/GraphiQL-darwin-x64/GraphiQL.app --token `echo ${GITHUB_TOKEN}`"
15+
"release": "node node_modules/electron-release/cli --app release/darwin-x64/GraphiQL-darwin-x64/GraphiQL.app --token `echo ${GITHUB_TOKEN}`",
16+
"test": "./node_modules/mocha/bin/mocha"
1617
},
1718
"author": "Adam Miskiewicz <adam.skevy@mac.com> (http://github.com/skevy)",
1819
"license": "MIT",
@@ -42,21 +43,26 @@
4243
"babel-core": "^5.8.25",
4344
"babel-loader": "^5.3.2",
4445
"babel-runtime": "^5.8.25",
46+
"chai": "^3.5.0",
47+
"chai-as-promised": "^5.3.0",
4548
"css-loader": "^0.19.0",
4649
"del": "^2.0.2",
4750
"electron-packager": "^7.0.2",
4851
"electron-prebuilt": "^1.2.0",
4952
"electron-rebuild": "^1.0.0",
5053
"electron-release": "^2.2.0",
54+
"eslint-plugin-react": "^5.2.2",
5155
"extract-text-webpack-plugin": "^0.8.2",
5256
"file-loader": "^0.8.4",
5357
"github-latest-release": "^0.1.1",
5458
"html-loader": "^0.3.0",
5559
"json-loader": "^0.5.3",
5660
"loaders-by-extension": "^1.0.0",
5761
"minimist": "^1.2.0",
62+
"mocha": "^2.5.3",
5863
"raw-loader": "^0.5.1",
5964
"react-hot-loader": "^1.3.0",
65+
"spectron": "^3.2.3",
6066
"stats-webpack-plugin": "^0.2.2",
6167
"style-loader": "^0.12.4",
6268
"url-loader": "^0.5.6",

script/ci

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
3+
export DISPLAY=:99.0
4+
sh -e /etc/init.d/xvfb start
5+
sleep 3
6+
fi

test/basic.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
require('./global-setup');
2+
3+
describe('Basic Test', function () {
4+
it('opens a window', function () {
5+
return this.app.client.waitUntilWindowLoaded()
6+
.getWindowCount().should.eventually.equal(1);
7+
});
8+
});

test/global-setup.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
var Application = require('spectron').Application;
2+
var chai = require('chai');
3+
var chaiAsPromised = require('chai-as-promised');
4+
var path = require('path');
5+
6+
global.before(function () {
7+
chai.should();
8+
chai.use(chaiAsPromised);
9+
});
10+
11+
beforeEach(function () {
12+
this.app = new Application({
13+
path: require('electron-prebuilt'),
14+
args: [path.join(__dirname, '../')]
15+
});
16+
this.app.start();
17+
18+
return this.app.start().then(function (app) {
19+
chaiAsPromised.transferPromiseness = app.transferPromiseness;
20+
return app;
21+
});
22+
});
23+
24+
afterEach(function () {
25+
if (this.app && this.app.isRunning()) {
26+
return this.app.stop();
27+
}
28+
});

0 commit comments

Comments
 (0)