@pact-foundation/pact-node
Advanced tools
Comparing version 4.7.0 to 4.8.0
{ | ||
"name": "@pact-foundation/pact-node", | ||
"version": "4.7.0", | ||
"version": "4.8.0", | ||
"description": "A wrapper for the Ruby version of Pact to work within Node", | ||
@@ -5,0 +5,0 @@ "main": "./src/pact.js", |
@@ -70,2 +70,3 @@ <img src="https://raw.githubusercontent.com/pact-foundation/pact-logo/master/media/logo-black.png" width="200"> | ||
pactBrokerPassword: <String>, // Password for Pact Broker basic authentication. Optional | ||
timeout: <Number> // The duration in ms we should wait to confirm verification process was successful. Defaults to 30000, Optional. | ||
}; | ||
@@ -72,0 +73,0 @@ |
@@ -15,3 +15,3 @@ var checkTypes = require('check-types'), | ||
// Constructor | ||
function Verifier(providerBaseUrl, pactUrls, providerStatesUrl, providerStatesSetupUrl, pactBrokerUsername, pactBrokerPassword) { | ||
function Verifier(providerBaseUrl, pactUrls, providerStatesUrl, providerStatesSetupUrl, pactBrokerUsername, pactBrokerPassword, timeout) { | ||
this._options = {}; | ||
@@ -24,2 +24,3 @@ this._options.providerBaseUrl = providerBaseUrl; | ||
this._options.pactBrokerPassword = pactBrokerPassword; | ||
this._options.timeout = timeout; | ||
} | ||
@@ -83,3 +84,3 @@ | ||
logger.info('Created Pact Verifier process with PID: ' + this._instance.pid); | ||
return deferred.promise.timeout(10000, "Couldn't start Pact Verifier process with PID: " + this._instance.pid) | ||
return deferred.promise.timeout(this._options.timeout, "Timeout waiting for verification process to complete (PID: " + this._instance.pid + ")") | ||
.tap(function (data) { | ||
@@ -97,2 +98,3 @@ logger.info('Pact Verification succeeded.'); | ||
options.providerStatesSetupUrl = options.providerStatesSetupUrl || ''; | ||
options.timeout = options.timeout || 30000; | ||
@@ -152,3 +154,5 @@ options.pactUrls = _.chain(options.pactUrls) | ||
return new Verifier(options.providerBaseUrl, options.pactUrls, options.providerStatesUrl, options.providerStatesSetupUrl, options.pactBrokerUsername, options.pactBrokerPassword); | ||
checkTypes.assert.positive(options.timeout); | ||
return new Verifier(options.providerBaseUrl, options.pactUrls, options.providerStatesUrl, options.providerStatesSetupUrl, options.pactBrokerUsername, options.pactBrokerPassword, options.timeout); | ||
}; |
@@ -46,2 +46,13 @@ var verifierFactory = require('./verifier'), | ||
}); | ||
context("when given an invalid timeout", function () { | ||
it("should fail with an error", function () { | ||
expect(function () { | ||
verifierFactory({ | ||
providerBaseUrl: "http://localhost", | ||
pactUrls: ["http://idontexist"], | ||
timeout: -10 | ||
}); | ||
}).to.throw(Error); | ||
}); | ||
}); | ||
context("when given remote Pact URLs that don't exist", function () { | ||
@@ -48,0 +59,0 @@ it("should pass through to the Pact Verifier regardless", function () { |
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
105533
2575
175