wdio-docker-service
Advanced tools
Comparing version 1.0.1 to 1.1.0
/*! launcher.js */ | ||
const DockerLauncher = require("./lib/launcher"); | ||
const DockerLauncher = require('./lib/launcher'); | ||
module.exports = new DockerLauncher(); |
{ | ||
"name": "wdio-docker-service", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "WebdriverIO service to start and stop docker container (for Selenium and more)", | ||
@@ -14,7 +14,8 @@ "repository": { | ||
"scripts": { | ||
"prepublish": "npm prune && npm run build", | ||
"prepare": "npm prune && npm run build", | ||
"build": "babel src --out-dir lib -s > /dev/null", | ||
"test": "eslint -c .eslintrc.json src/**/*.js && mocha --require babel-register test/unit/**/*Spec.js", | ||
"test:integration": "npm run build && wdio test/integration/wdio.conf.js", | ||
"coverage": "nyc --reporter=lcov npm test" | ||
"test": "eslint -c .eslintrc.json src/**/*.js && npm run test:unit && npm run test:integration", | ||
"test:unit": "nyc mocha --require babel-register --recursive ./test/unit", | ||
"test:integration": "wdio test/integration/docker-selenium/wdio.conf.js && wdio test/integration/docker-app/wdio.conf.js", | ||
"coverage": "nyc report --reporter=text-lcov | coveralls" | ||
}, | ||
@@ -36,2 +37,3 @@ "keywords": [ | ||
"chai": "^4.1.2", | ||
"coveralls": "^3.0.0", | ||
"eslint": "^4.15.0", | ||
@@ -43,2 +45,4 @@ "gulp": "^3.9.1", | ||
"wdio-mocha-framework": "^0.5.12", | ||
"wdio-selenium-standalone-service": "0.0.9", | ||
"wdio-spec-reporter": "^0.1.3", | ||
"webdriverio": "^4.9.11" | ||
@@ -55,4 +59,7 @@ }, | ||
"nyc": { | ||
"include": [ | ||
"src/**/*.js" | ||
"exclude": [ | ||
"index.js", | ||
"launcher.js", | ||
"lib", | ||
"test" | ||
], | ||
@@ -63,4 +70,6 @@ "require": [ | ||
"sourceMap": false, | ||
"instrument": false | ||
"instrument": true, | ||
"cache": false, | ||
"all": true | ||
} | ||
} |
@@ -1,2 +0,4 @@ | ||
WDIO Docker Service [![Maintainability](https://api.codeclimate.com/v1/badges/fa04188e6558671dbd9e/maintainability)](https://codeclimate.com/github/stsvilik/wdio-docker-service/maintainability) [![Build Status](https://travis-ci.org/stsvilik/wdio-docker-service.svg?branch=tests%2Fchild-process)](https://travis-ci.org/stsvilik/wdio-docker-service) | ||
WDIO Docker Service [![Maintainability](https://api.codeclimate.com/v1/badges/fa04188e6558671dbd9e/maintainability)](https://codeclimate.com/github/stsvilik/wdio-docker-service/maintainability) | ||
[![Build Status](https://travis-ci.org/stsvilik/wdio-docker-service.svg?branch=master)](https://travis-ci.org/stsvilik/wdio-docker-service) | ||
[![Coverage Status](https://coveralls.io/repos/github/stsvilik/wdio-selenium-standalone-service/badge.svg)](https://coveralls.io/github/stsvilik/wdio-selenium-standalone-service) | ||
=== | ||
@@ -116,2 +118,7 @@ | ||
### onDockerReady | ||
A callback method which is called when Docker application is ready. Readiness is determined by ability to ping `healthCheck` url. | ||
Type: `Function` | ||
### dockerLogs | ||
@@ -118,0 +125,0 @@ Path to where logs from docker container should be stored |
@@ -27,5 +27,10 @@ import fs from 'fs-extra'; | ||
options, | ||
} | ||
}, | ||
onDockerReady | ||
} = config; | ||
if (!image) { | ||
return Promise.reject(new Error('dockerOptions.image is a required property')); | ||
} | ||
const Logger = coloredLogs ? require('./utils/color-logger') : console; | ||
@@ -48,2 +53,7 @@ | ||
return this.docker.run() | ||
.then(() => { | ||
if (typeof onDockerReady === 'function') { | ||
onDockerReady(); | ||
} | ||
}) | ||
.catch((err) => { | ||
@@ -55,3 +65,5 @@ console.error(err.message); | ||
onComplete() { | ||
return this.docker.stop(); | ||
if (this.docker) { | ||
return this.docker.stop(); | ||
} | ||
} | ||
@@ -58,0 +70,0 @@ |
@@ -16,2 +16,7 @@ /** | ||
if (typeof value === 'object' && typeof acc[key] === 'object') { | ||
deepMerge(acc[key], value); | ||
return; | ||
} | ||
acc[key] = value; | ||
@@ -18,0 +23,0 @@ }); |
@@ -25,2 +25,3 @@ import camelToDash from './camel-to-dash'; | ||
* @param {Object} options | ||
* @param {String} [healthCheck] Url that verifies that service is running | ||
* @param {String} [command] docker command that follows image/tag name | ||
@@ -30,3 +31,3 @@ * @param {String} [args] docker args that follow image/tag name | ||
*/ | ||
constructor(image, { debug = false, options = {}, command, args }, logger) { | ||
constructor(image, { debug = false, options = {}, healthCheck, command, args }, logger) { | ||
super(); | ||
@@ -38,2 +39,3 @@ | ||
this.debug = debug; | ||
this.healthCheck = healthCheck || DEFAULT_HEALTH_CHECK; | ||
this.image = image; | ||
@@ -131,7 +133,5 @@ this.logger = logger; | ||
const { healthCheck = DEFAULT_HEALTH_CHECK } = this.options; | ||
const poll = () => { | ||
if (healthCheck !== undefined) { | ||
Ping(healthCheck) | ||
if (this.healthCheck !== undefined) { | ||
Ping(this.healthCheck) | ||
.then(() => { | ||
@@ -138,0 +138,0 @@ resolve(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112405
46
1191
131
15
4