@pact-foundation/pact-node
Advanced tools
Comparing version 10.8.1 to 10.9.0
@@ -5,2 +5,17 @@ # Change Log | ||
# [10.9.0](https://github.com/pact-foundation/pact-node/compare/v10.8.1...v10.9.0) (2020-04-10) | ||
### Bug Fixes | ||
* **standalone:** update standalone to 1.82.3 ([#223](https://github.com/pact-foundation/pact-node/issues/223)) ([70fac35](https://github.com/pact-foundation/pact-node/commit/70fac353007e0ebc7b622415cd66bfe25e9c2d2f)) | ||
### Features | ||
* **verifier:** Add support for includeWipPactsSince ([c691162](https://github.com/pact-foundation/pact-node/commit/c6911620695435b5e47c22bc0d526ca559e5a356)) | ||
* deprecate consumerVersionTag and providerVersionTag. Fixes [#218](https://github.com/pact-foundation/pact-node/issues/218) ([3e932bd](https://github.com/pact-foundation/pact-node/commit/3e932bd7c80a468a68dff21d7e4457732b5af234)) | ||
## [10.8.1](https://github.com/pact-foundation/pact-node/compare/v0.0.7...v10.8.1) (2020-04-08) | ||
@@ -7,0 +22,0 @@ |
{ | ||
"name": "@pact-foundation/pact-node", | ||
"version": "10.8.1", | ||
"version": "10.9.0", | ||
"description": "A wrapper for the Ruby version of Pact to work within Node", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -12,3 +12,3 @@ <img src="https://raw.githubusercontent.com/pact-foundation/pact-logo/master/media/logo-black.png" width="200"> | ||
An idiomatic Node interface for the [Pact](http://pact.io) mock service (Consumer) and Verification (Provider) process, as well as the [Pact CLI Tools](https://github.com/pact-foundation/pact-ruby-standalone). | ||
An idiomatic Node wrapper for the [Pact](http://pact.io) [CLI Tools](https://github.com/pact-foundation/pact-ruby-standalone). | ||
@@ -84,2 +84,10 @@ ***NOTE*: If you are new to Pact and are wanting to get started with contract testing, you almost certainly don't want to use this package. Head over to [Pact JS](https://github.com/pact-foundation/pact-js/) instead.** | ||
If your environment uses self-signed certificates from an internal Certificate Authority (CA), you can configure this using the standard options in an [npmrc](https://docs.npmjs.com/configuring-npm/npmrc.html) file as per below: | ||
_~/.npmrc_: | ||
``` | ||
cafile=/etc/ssl/certs/ca-certificates.crt | ||
strict-ssl=true | ||
``` | ||
## Which Library/Package should I use? | ||
@@ -274,4 +282,5 @@ | ||
| `consumerVersionSelectors` | false | ConsumerVersionSelector\|array | Use [Selectors](https://docs.pact.io/selectors) to is a way we specify which pacticipants and versions we want to use when configuring verifications. | | ||
| `consumerVersionTag` | false | string\|array | Retrieve the latest pacts with given tag(s) | | ||
| `providerVersionTag` | false | string\|array | Tag(s) to apply to the provider application | | ||
| `consumerVersionTags` | false | string\|array | Retrieve the latest pacts with given tag(s) | | ||
| `providerVersionTags` | false | string\|array | Tag(s) to apply to the provider application | | ||
| `includeWipPactsSince` | false | string | Includes pact marked as WIP since this date. String in the format %Y-%m-%d or %Y-%m-%dT%H:%M:%S.000%:z | | ||
| `pactUrls` | false | array | Array of local pact file paths or HTTP-based URLs. Required if _not_ using a Pact Broker. | | ||
@@ -278,0 +287,0 @@ | `providerStatesSetupUrl` | false | string | URL to send PUT requests to setup a given provider state | |
@@ -18,3 +18,3 @@ import q = require('q'); | ||
} | ||
export interface VerifierOptions { | ||
interface CurrentVerifierOptions { | ||
providerBaseUrl: string; | ||
@@ -24,8 +24,7 @@ provider?: string; | ||
pactBrokerUrl?: string; | ||
providerStatesSetupUrl?: string; | ||
pactBrokerUsername?: string; | ||
pactBrokerPassword?: string; | ||
pactBrokerToken?: string; | ||
consumerVersionTag?: string | string[]; | ||
providerVersionTag?: string | string[]; | ||
consumerVersionTags?: string | string[]; | ||
providerVersionTags?: string | string[]; | ||
consumerVersionSelector?: ConsumerVersionSelector[]; | ||
@@ -37,4 +36,4 @@ customProviderHeaders?: string[]; | ||
timeout?: number; | ||
tags?: string[]; | ||
verbose?: boolean; | ||
includeWipPactsSince?: string; | ||
monkeypatch?: string; | ||
@@ -44,1 +43,8 @@ format?: 'json' | 'xml' | 'progress' | 'RspecJunitFormatter'; | ||
} | ||
interface DeprecatedVerifierOptions { | ||
consumerVersionTag?: string | string[]; | ||
providerStatesSetupUrl?: string; | ||
providerVersionTag?: string | string[]; | ||
tags?: string[]; | ||
} | ||
export declare type VerifierOptions = CurrentVerifierOptions & DeprecatedVerifierOptions; |
@@ -27,2 +27,4 @@ "use strict"; | ||
providerVersionTag: '--provider-version-tag', | ||
consumerVersionTags: '--consumer-version-tag', | ||
providerVersionTags: '--provider-version-tag', | ||
consumerVersionSelector: '--consumer-version-selector', | ||
@@ -35,2 +37,3 @@ publishVerificationResult: '--publish-verification-results', | ||
verbose: '--verbose', | ||
includeWipPactsSince: '--include-wip-pacts-since', | ||
monkeypatch: '--monkeypatch', | ||
@@ -48,3 +51,23 @@ format: '--format', | ||
options.providerVersionTag = options.providerVersionTag || []; | ||
options.consumerVersionTags = options.consumerVersionTags || []; | ||
options.providerVersionTags = options.providerVersionTags || []; | ||
options.consumerVersionSelector = options.consumerVersionSelector || []; | ||
if (!_.isEmpty(options.consumerVersionTag) && | ||
!_.isEmpty(options.consumerVersionTags)) { | ||
throw new Error("Must not use both 'consumerVersionTags' and 'consumerVersionTag'. Please use 'consumerVersionTags' instead"); | ||
} | ||
if (!_.isEmpty(options.providerVersionTag) && | ||
!_.isEmpty(options.providerVersionTags)) { | ||
throw new Error("Must not use both 'providerVersionTags' and 'providerVersionTag'. Please use 'providerVersionTags' instead"); | ||
} | ||
if (options.consumerVersionTags && | ||
checkTypes.string(options.consumerVersionTags)) { | ||
options.consumerVersionTags = [options.consumerVersionTags]; | ||
} | ||
checkTypes.assert.array.of.string(options.consumerVersionTags); | ||
if (options.providerVersionTags && | ||
checkTypes.string(options.providerVersionTags)) { | ||
options.providerVersionTags = [options.providerVersionTags]; | ||
} | ||
checkTypes.assert.array.of.string(options.providerVersionTags); | ||
if (options.consumerVersionTag && | ||
@@ -60,2 +83,9 @@ checkTypes.string(options.consumerVersionTag)) { | ||
checkTypes.assert.array.of.string(options.providerVersionTag); | ||
if (!_.isEmpty(options.consumerVersionTag) || | ||
!_.isEmpty(options.providerVersionTag)) { | ||
logger_1.default.warn("'consumerVersionTag' and 'providerVersionTag' have been deprecated, please use 'consumerVersionTags' or 'providerVersionTags' instead"); | ||
} | ||
if (options.includeWipPactsSince !== undefined) { | ||
checkTypes.assert.nonEmptyString(options.includeWipPactsSince); | ||
} | ||
options.pactUrls = _.chain(options.pactUrls) | ||
@@ -130,3 +160,3 @@ .map(function (uri) { | ||
if (options.tags) { | ||
logger_1.default.warn("'tags' has been deprecated as at v8.0.0, please use 'consumerVersionTag' instead"); | ||
logger_1.default.warn("'tags' has been deprecated as at v8.0.0, please use 'consumerVersionTags' instead"); | ||
} | ||
@@ -133,0 +163,0 @@ checkTypes.assert.positive(options.timeout); |
@@ -147,2 +147,22 @@ "use strict"; | ||
}); | ||
context('when using includeWipPactsSince', function () { | ||
it('should accept a non-empty string', function () { | ||
var verifier = verifier_1.default({ | ||
providerBaseUrl: 'http://localhost', | ||
pactUrls: ['http://idontexist'], | ||
includeWipPactsSince: 'thisshouldactuallybeadate', | ||
}); | ||
expect(verifier).to.be.a('object'); | ||
expect(verifier).to.respondTo('verify'); | ||
}); | ||
it('should not accept an empty string', function () { | ||
expect(function () { | ||
return verifier_1.default({ | ||
providerBaseUrl: 'http://localhost', | ||
pactUrls: ['http://idontexist'], | ||
includeWipPactsSince: '', | ||
}); | ||
}).to.throw(Error); | ||
}); | ||
}); | ||
context('when an using format option', function () { | ||
@@ -221,3 +241,3 @@ it("should work with either 'json' or 'xml'", function () { | ||
}); | ||
context('when consumerVersionTag is not provided', function () { | ||
context('when consumerVersionTags is not provided', function () { | ||
it('should not fail', function () { | ||
@@ -232,2 +252,12 @@ expect(function () { | ||
}); | ||
context('when consumerVersionTags is provided as a string', function () { | ||
it('should convert the argument to an array', function () { | ||
var v = verifier_1.default({ | ||
providerBaseUrl: 'http://localhost', | ||
pactUrls: [path.dirname(currentDir)], | ||
consumerVersionTags: 'tag-1', | ||
}); | ||
expect(v.options.consumerVersionTags).to.deep.eq(['tag-1']); | ||
}); | ||
}); | ||
context('when consumerVersionTag is provided as a string', function () { | ||
@@ -243,3 +273,3 @@ it('should convert the argument to an array', function () { | ||
}); | ||
context('when consumerVersionTag is provided as an array', function () { | ||
context('when consumerVersionTags is provided as an array', function () { | ||
it('should not fail', function () { | ||
@@ -250,3 +280,3 @@ expect(function () { | ||
pactUrls: [path.dirname(currentDir)], | ||
consumerVersionTag: ['tag-1'], | ||
consumerVersionTags: ['tag-1'], | ||
}); | ||
@@ -256,3 +286,15 @@ }).to.not.throw(Error); | ||
}); | ||
context('when providerVersionTag is not provided', function () { | ||
context('when consumerVersionTags and consumerVersionTag are provided', function () { | ||
it('should fail', function () { | ||
expect(function () { | ||
verifier_1.default({ | ||
providerBaseUrl: 'http://localhost', | ||
pactUrls: [path.dirname(currentDir)], | ||
consumerVersionTags: ['tag-1'], | ||
consumerVersionTag: ['tag-1'], | ||
}); | ||
}).to.throw(Error); | ||
}); | ||
}); | ||
context('when providerVersionTags is not provided', function () { | ||
it('should not fail', function () { | ||
@@ -267,2 +309,12 @@ expect(function () { | ||
}); | ||
context('when providerVersionTags is provided as a string', function () { | ||
it('should convert the argument to an array', function () { | ||
var v = verifier_1.default({ | ||
providerBaseUrl: 'http://localhost', | ||
pactUrls: [path.dirname(currentDir)], | ||
providerVersionTags: 'tag-1', | ||
}); | ||
expect(v.options.providerVersionTags).to.deep.eq(['tag-1']); | ||
}); | ||
}); | ||
context('when providerVersionTag is provided as a string', function () { | ||
@@ -278,3 +330,3 @@ it('should convert the argument to an array', function () { | ||
}); | ||
context('when providerVersionTag is provided as an array', function () { | ||
context('when providerVersionTags is provided as an array', function () { | ||
it('should not fail', function () { | ||
@@ -285,3 +337,3 @@ expect(function () { | ||
pactUrls: [path.dirname(currentDir)], | ||
providerVersionTag: ['tag-1'], | ||
providerVersionTags: ['tag-1'], | ||
}); | ||
@@ -291,2 +343,14 @@ }).to.not.throw(Error); | ||
}); | ||
context('when providerVersionTags and providerVersionTag are provided', function () { | ||
it('should fail', function () { | ||
expect(function () { | ||
verifier_1.default({ | ||
providerBaseUrl: 'http://localhost', | ||
pactUrls: [path.dirname(currentDir)], | ||
providerVersionTags: ['tag-1'], | ||
providerVersionTag: ['tag-1'], | ||
}); | ||
}).to.throw(Error); | ||
}); | ||
}); | ||
context('when using a bearer token', function () { | ||
@@ -293,0 +357,0 @@ context('and specifies a username or password', function () { |
@@ -1,2 +0,2 @@ | ||
export declare const PACT_STANDALONE_VERSION = "1.82.2"; | ||
export declare const PACT_STANDALONE_VERSION = "1.82.3"; | ||
export declare function createConfig(): Config; | ||
@@ -3,0 +3,0 @@ export declare function getBinaryEntry(platform?: string, arch?: string): BinaryEntry; |
@@ -18,3 +18,3 @@ "use strict"; | ||
}); | ||
exports.PACT_STANDALONE_VERSION = '1.82.2'; | ||
exports.PACT_STANDALONE_VERSION = '1.82.3'; | ||
var PACT_DEFAULT_LOCATION = "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v" + exports.PACT_STANDALONE_VERSION + "/"; | ||
@@ -21,0 +21,0 @@ var HTTP_REGEX = /^http(s?):\/\//; |
Sorry, the diff of this file is not supported yet
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
435310
5889
480