diff --git a/package.json b/package.json index 1ef636d2..c7e0a853 100644 --- a/package.json +++ b/package.json @@ -14,10 +14,8 @@ "dependencies": { "aphrodite-simple": "0.4.1", "color": "0.11.3", - "electron-mocha": "^3.0.0", "hterm-umdjs": "1.1.3", "json-loader": "0.5.4", - "mocha": "^3.0.0", "mousetrap": "1.6.0", "ms": "0.7.1", "object-values": "1.0.0", @@ -30,10 +28,10 @@ "redux": "3.6.0", "redux-thunk": "2.1.0", "reselect": "2.5.4", - "seamless-immutable": "6.1.1", - "should": "^11.0.0" + "seamless-immutable": "6.1.1" }, "devDependencies": { + "ava": "^0.16.0", "babel-cli": "^6.11.4", "babel-core": "^6.11.4", "babel-loader": "^6.2.4", @@ -47,6 +45,7 @@ "eslint-plugin-react": "^6.2.2", "husky": "^0.11.6", "redux-logger": "^2.6.1", + "spectron": "^3.4.0", "webpack": "^2.1.0-beta.15", "xo": "^0.16.0" }, @@ -107,7 +106,7 @@ "start": "concurrently --kill-others --raw \"npm run dev\" \"electron app\"", "dev": "webpack -w", "build": "NODE_ENV=production webpack", - "test": "xo && electron-mocha test/*", + "test": "npm run pack && xo && ava", "prepublish": "npm test", "prepush": "npm test", "postinstall": "install-app-deps", diff --git a/test/app/plugins.js b/test/app/plugins.js deleted file mode 100644 index e8269fd7..00000000 --- a/test/app/plugins.js +++ /dev/null @@ -1,23 +0,0 @@ -/* eslint-disable prefer-arrow-callback */ -require('../setup'); - -const {_toDependencies} = require('../../app/plugins'); - -describe('plugins', function () { - describe('#toDependencies()', function () { - it('should convert dependencies form hyperterm\'s format to npm\'s', function () { - const plugins = ['project1', 'project2#1.0.0', 'project3@beta', - '@org1/project4#1.0.0', '@org2/project5@alpha', - '@org3/project6']; - - _toDependencies({plugins}).should.be.eql({ - 'project1': 'latest', - 'project2': '1.0.0', - 'project3': 'beta', - '@org1/project4': '1.0.0', - '@org2/project5': 'alpha', - '@org3/project6': 'latest' - }); - }); - }); -}); diff --git a/test/index.js b/test/index.js new file mode 100644 index 00000000..bbc629d7 --- /dev/null +++ b/test/index.js @@ -0,0 +1,30 @@ +// Native +import path from 'path'; + +// Packages +import test from 'ava'; +import {Application} from 'spectron'; + +let app; + +test.before(async () => { + app = new Application({ + path: path.join(__dirname, '../dist/mac/HyperTerm.app/Contents/MacOS/HyperTerm') + }); + + await app.start(); +}); + +test.after(async () => { + await app.stop(); +}); + +test('check window count', async t => { + await app.client.waitUntilWindowLoaded(); + t.is(await app.client.getWindowCount(), 4); +}); + +test('see if dev tools are open', async t => { + await app.client.waitUntilWindowLoaded(); + t.false(await app.browserWindow.isDevToolsOpened()); +}); diff --git a/test/setup.js b/test/setup.js deleted file mode 100644 index 4041736a..00000000 --- a/test/setup.js +++ /dev/null @@ -1,5 +0,0 @@ -require('should'); - -const config = require('../app/config'); - -config.init();