зеркало из https://github.com/docker/kitematic.git
Adding code coverage to unit tests
Signed-off-by: Jeffrey Morgan <jmorganca@gmail.com>
This commit is contained in:
Родитель
f063346e02
Коммит
be368f7a77
|
@ -3,6 +3,7 @@
|
|||
build
|
||||
dist
|
||||
node_modules
|
||||
coverage
|
||||
npm-debug.log
|
||||
|
||||
# Signing Identity
|
||||
|
|
|
@ -27,5 +27,5 @@
|
|||
"jest": true,
|
||||
"pit": true
|
||||
},
|
||||
"predef": [ "-Promise" ]
|
||||
"predef": [ "Promise" ]
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[![CircleCI](https://img.shields.io/circleci/project/kitematic/kitematic.svg)](https://circleci.com/gh/kitematic/kitematic/tree/master)
|
||||
[![Coverage Status](https://coveralls.io/repos/kitematic/kitematic/badge.svg)](https://coveralls.io/r/kitematic/kitematic)
|
||||
[![bitHound Score](https://app.bithound.io/kitematic/kitematic/badges/score.svg)](http://app.bithound.io/kitematic/kitematic)
|
||||
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/kitematic/kitematic?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
|
|
21
package.json
21
package.json
|
@ -12,7 +12,7 @@
|
|||
"bugs": "https://github.com/kitematic/kitematic/issues",
|
||||
"scripts": {
|
||||
"start": "gulp",
|
||||
"test": "jest",
|
||||
"test": "jest --coverage",
|
||||
"release": "gulp release",
|
||||
"release:beta": "gulp release --beta",
|
||||
"preinstall": "./util/deps",
|
||||
|
@ -28,16 +28,21 @@
|
|||
"jest": {
|
||||
"scriptPreprocessor": "<rootDir>/util/preprocessor.js",
|
||||
"setupEnvScriptFile": "<rootDir>/util/testenv.js",
|
||||
"collectCoverage": true,
|
||||
"testDirectoryName": "src",
|
||||
"testPathIgnorePatterns": [
|
||||
"/node_modules/",
|
||||
"^((?!-test).)*$"
|
||||
],
|
||||
"unmockedModulePathPatterns": [
|
||||
"stream",
|
||||
"tty",
|
||||
"net",
|
||||
"crypto",
|
||||
"stream",
|
||||
"<rootDir>/node_modules/.*JSONStream",
|
||||
"<rootDir>/node_modules/object-assign",
|
||||
"<rootDir>/node_modules/underscore",
|
||||
"<rootDir>/node_modules/react",
|
||||
"<rootDir>/node_modules/bluebird",
|
||||
"<rootDir>/node_modules/babel"
|
||||
"<rootDir>/node_modules/bluebird"
|
||||
]
|
||||
},
|
||||
"docker-version": "1.5.0",
|
||||
|
@ -51,7 +56,8 @@
|
|||
"async": "^0.9.0",
|
||||
"bluebird": "^2.9.12",
|
||||
"bugsnag-js": "^2.4.7",
|
||||
"dockerode": "^2.0.7",
|
||||
"coveralls": "^2.11.2",
|
||||
"dockerode": "^2.1.1",
|
||||
"exec": "0.2.0",
|
||||
"jquery": "^2.1.3",
|
||||
"minimist": "^1.1.0",
|
||||
|
@ -76,6 +82,7 @@
|
|||
"gulp-cssmin": "^0.1.6",
|
||||
"gulp-download-atom-shell": "0.0.4",
|
||||
"gulp-if": "^1.2.5",
|
||||
"gulp-insert": "^0.4.0",
|
||||
"gulp-less": "^3.0.1",
|
||||
"gulp-livereload": "^3.8.0",
|
||||
"gulp-plumber": "^0.6.6",
|
||||
|
@ -83,7 +90,7 @@
|
|||
"gulp-shell": "^0.3.0",
|
||||
"gulp-sourcemaps": "^1.5.0",
|
||||
"gulp-util": "^3.0.4",
|
||||
"jest-cli": "^0.4.0",
|
||||
"jest-cli": "kitematic/jest",
|
||||
"jsxhint": "^0.12.1",
|
||||
"react-tools": "^0.12.2",
|
||||
"run-sequence": "^1.0.2"
|
||||
|
|
|
@ -74,7 +74,9 @@ var ContainerHome = React.createClass({
|
|||
if (this.props.error) {
|
||||
body = (
|
||||
<div className="details-progress">
|
||||
<h3>There was a problem connecting to the Docker Engine in the VirtualBox VM.<br/>This could be caused because this Mac is currently connected to a VPN, blocking access to the VM. If the issue persists, please <a onClick={this.handleErrorClick}>file a ticket on our GitHub repo.</a></h3>
|
||||
<h3>An error occurred:</h3>
|
||||
<h2>{this.props.error.statusCode} {this.props.error.reason} - {this.props.error.json}</h2>
|
||||
<h3>If you feel that this error is invalid, please <a onClick={this.handleErrorClick}>file a ticket on our GitHub repo.</a></h3>
|
||||
<Radial progress={100} error={true} thick={true} transparent={true}/>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -56,6 +56,12 @@ var ContainerStore = assign(Object.create(EventEmitter.prototype), {
|
|||
var data = JSON.parse(str);
|
||||
console.log(data);
|
||||
|
||||
if (data.error) {
|
||||
_error = data.error;
|
||||
callback(data.error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.status && (data.status === 'Pulling dependent layers' || data.status.indexOf('already being pulled by another client') !== -1)) {
|
||||
blockedCallback();
|
||||
return;
|
||||
|
@ -82,7 +88,8 @@ var ContainerStore = assign(Object.create(EventEmitter.prototype), {
|
|||
progressCallback(totalProgress);
|
||||
});
|
||||
stream.on('end', function () {
|
||||
callback();
|
||||
callback(_error);
|
||||
_error = null;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -31,11 +31,11 @@ var ImageCard = React.createClass({
|
|||
handleTagOverlayClick: function (name) {
|
||||
var $tagOverlay = $(this.getDOMNode()).find('.tag-overlay');
|
||||
$tagOverlay.fadeIn(300);
|
||||
$.get('https://registry.hub.docker.com/v1/repositories/' + name + '/tags', function (result) {
|
||||
$.get('https://registry.hub.docker.com/v1/repositories/' + name + '/tags', result => {
|
||||
this.setState({
|
||||
tags: result
|
||||
});
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
handleCloseTagOverlay: function () {
|
||||
var $tagOverlay = $(this.getDOMNode()).find('.tag-overlay');
|
||||
|
@ -50,6 +50,14 @@ var ImageCard = React.createClass({
|
|||
}
|
||||
util.exec(['open', $repoUri + this.props.image.name]);
|
||||
},
|
||||
componentDidMount: function() {
|
||||
$.get('https://registry.hub.docker.com/v1/repositories/' + this.props.image.name + '/tags', result => {
|
||||
this.setState({
|
||||
tags: result,
|
||||
chosenTag: result[0].name
|
||||
});
|
||||
});
|
||||
},
|
||||
render: function () {
|
||||
var self = this;
|
||||
var name;
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
jest.dontMock('../src/SetupStore');
|
||||
var setupStore = require('../src/SetupStore');
|
||||
var virtualBox = require('../src/VirtualBox');
|
||||
var util = require('../src/Util');
|
||||
var machine = require('../src/DockerMachine');
|
||||
var setupUtil = require('../src/SetupUtil');
|
||||
var Promise = require('bluebird');
|
||||
jest.dontMock('./SetupStore');
|
||||
var setupStore = require('./SetupStore');
|
||||
var virtualBox = require('./VirtualBox');
|
||||
var util = require('./Util');
|
||||
var machine = require('./DockerMachine');
|
||||
var setupUtil = require('./SetupUtil');
|
||||
|
||||
describe('SetupStore', function () {
|
||||
describe('download step', function () {
|
|
@ -1,7 +1,6 @@
|
|||
jest.dontMock('../src/VirtualBox');
|
||||
var virtualBox = require('../src/VirtualBox');
|
||||
var util = require('../src/Util');
|
||||
var Promise = require('bluebird');
|
||||
jest.dontMock('./VirtualBox');
|
||||
var virtualBox = require('./VirtualBox');
|
||||
var util = require('./Util');
|
||||
|
||||
describe('VirtualBox', function () {
|
||||
it('returns the right command', function () {
|
Загрузка…
Ссылка в новой задаче