@pact-foundation/pact-node
Advanced tools
Comparing version 6.6.0 to 6.7.0
@@ -22,3 +22,3 @@ #!/usr/bin/env node | ||
.option("-i, --pact-version <n>", "The Pact specification version to use when writing the Pact files. Default is 1.", cli.INT) | ||
.option("-w, --pact-file-write-mode <m>", "Controls how pact files are written to disk. One of 'overwrite', 'update', 'merge'") | ||
.option("-w, --pact-file-write-mode <m>", "Controls how pact files are written to disk. One of 'overwrite', 'update', 'merge'", /^overwrite|update|merge$/) | ||
.option("--consumer <consumerName>", "Specify consumer name for written Pact files.") | ||
@@ -53,3 +53,13 @@ .option("--provider <providerName>", "Specify provider name for written Pact files.") | ||
.action(function (args, options) { return pact_1.default.verifyPacts(options); }); | ||
cli | ||
.command("publish") | ||
.description("Publishes Pact Contracts to the broker") | ||
.option("-p, --pact-files-or-dirs <paths>", "Comma separated list of Pact file or directory paths", cli.LIST, null, true) | ||
.option("-c, --consumer-version <version>", "Semver-style version of the consumer e.g. 1.0.0.", /^\d+\.\d+\.\d+$/, null, true) | ||
.option("-b, --pact-broker <URL>", "URL of the Pact Broker to publish pacts to.") | ||
.option("-username, --pact-broker-username <user>", "Pact Broker username.") | ||
.option("-password, --pact-broker-password <password>", "Pact Broker password.") | ||
.option("-t, --tags <tags>", "Comma separated list of tags to attach to the Pact Contracts being published", cli.LIST) | ||
.action(function (args, options) { return pact_1.default.publishPacts(options); }); | ||
cli.parse(process.argv); | ||
//# sourceMappingURL=pact-cli.js.map |
@@ -9,2 +9,3 @@ "use strict"; | ||
var provider_mock_1 = require("../test/integration/provider-mock"); | ||
var broker_mock_1 = require("../test/integration/broker-mock"); | ||
var decamelize = require("decamelize"); | ||
@@ -58,3 +59,3 @@ var _ = require("underscore"); | ||
}); | ||
context("with mock broker", function () { | ||
context("with provider mock", function () { | ||
var server; | ||
@@ -71,2 +72,26 @@ var PORT = 9123; | ||
}); | ||
describe("Publish Command", function () { | ||
it("should display help", function () { | ||
var p = CLI.runSync(["publish", "--help"]).then(function (cp) { return cp.stdout; }); | ||
return q.all([ | ||
expect(p).to.eventually.contain("USAGE"), | ||
expect(p).to.eventually.contain("pact publish") | ||
]); | ||
}); | ||
it("should fail if missing 'provider-base-url' argument", function () { | ||
return expect(CLI.runSync(["verify"]).then(function (cp) { return cp.stderr; })).to.eventually.contain("Must provide the providerBaseUrl argument"); | ||
}); | ||
context("with broker mock", function () { | ||
var PORT = 9123; | ||
var brokerBaseUrl = "http://localhost:" + PORT; | ||
var currentDir = (process && process.mainModule) ? process.mainModule.filename : ""; | ||
var server; | ||
before(function () { return broker_mock_1.default(PORT).then(function (s) { return server = s; }); }); | ||
after(function () { return server.close(); }); | ||
it("should work pointing to fake broker", function () { | ||
var p = CLI.runSync(["publish", "--pact-files-or-dirs", path.dirname(currentDir), "--consumer-version", "1.0.0", "--pact-broker", brokerBaseUrl]).then(function (cp) { return cp.stdout; }); | ||
return expect(p).to.eventually.be.fulfilled; | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -73,0 +98,0 @@ var CLI = (function () { |
@@ -9,2 +9,4 @@ import chai = require("chai"); | ||
import providerMock from "../test/integration/provider-mock"; | ||
import brokerMock from "../test/integration/broker-mock"; | ||
import * as http from "http"; | ||
const decamelize = require("decamelize"); | ||
@@ -67,4 +69,4 @@ const _ = require("underscore"); | ||
context("with mock broker", () => { | ||
let server: any; | ||
context("with provider mock", () => { | ||
let server: http.Server; | ||
const PORT = 9123; | ||
@@ -82,2 +84,31 @@ const providerBaseUrl = `http://localhost:${PORT}`; | ||
}); | ||
describe("Publish Command", () => { | ||
it("should display help", () => { | ||
const p = CLI.runSync(["publish", "--help"]).then((cp) => cp.stdout); | ||
return q.all([ | ||
expect(p).to.eventually.contain("USAGE"), | ||
expect(p).to.eventually.contain("pact publish") | ||
]); | ||
}); | ||
it("should fail if missing 'provider-base-url' argument", () => { | ||
return expect(CLI.runSync(["verify"]).then((cp) => cp.stderr)).to.eventually.contain("Must provide the providerBaseUrl argument"); | ||
}); | ||
context("with broker mock", () => { | ||
const PORT = 9123; | ||
const brokerBaseUrl = `http://localhost:${PORT}`; | ||
const currentDir = (process && process.mainModule) ? process.mainModule.filename : ""; | ||
let server: http.Server; | ||
before(() => brokerMock(PORT).then((s) => server = s)); | ||
after(() => server.close()); | ||
it("should work pointing to fake broker", () => { | ||
const p = CLI.runSync(["publish", "--pact-files-or-dirs", path.dirname(currentDir), "--consumer-version", "1.0.0", "--pact-broker", brokerBaseUrl]).then((cp) => cp.stdout); | ||
return expect(p).to.eventually.be.fulfilled; | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -84,0 +115,0 @@ |
@@ -5,3 +5,2 @@ #!/usr/bin/env node | ||
const cli = require("caporal"); | ||
const pkg = require("../package.json"); | ||
@@ -25,3 +24,3 @@ | ||
.option("-i, --pact-version <n>", "The Pact specification version to use when writing the Pact files. Default is 1.", cli.INT) | ||
.option("-w, --pact-file-write-mode <m>", "Controls how pact files are written to disk. One of 'overwrite', 'update', 'merge'") | ||
.option("-w, --pact-file-write-mode <m>", "Controls how pact files are written to disk. One of 'overwrite', 'update', 'merge'", /^overwrite|update|merge$/) | ||
.option("--consumer <consumerName>", "Specify consumer name for written Pact files.") | ||
@@ -59,2 +58,13 @@ .option("--provider <providerName>", "Specify provider name for written Pact files.") | ||
cli | ||
.command("publish") | ||
.description("Publishes Pact Contracts to the broker") | ||
.option("-p, --pact-files-or-dirs <paths>", "Comma separated list of Pact file or directory paths", cli.LIST, null, true) | ||
.option("-c, --consumer-version <version>", "Semver-style version of the consumer e.g. 1.0.0.", /^\d+\.\d+\.\d+$/, null, true) | ||
.option("-b, --pact-broker <URL>", "URL of the Pact Broker to publish pacts to.") | ||
.option("-username, --pact-broker-username <user>", "Pact Broker username.") | ||
.option("-password, --pact-broker-password <password>", "Pact Broker password.") | ||
.option("-t, --tags <tags>", "Comma separated list of tags to attach to the Pact Contracts being published", cli.LIST) | ||
.action((args: any, options: any) => pact.publishPacts(options)); | ||
cli.parse(process.argv); |
{ | ||
"name": "@pact-foundation/pact-node", | ||
"version": "6.6.0", | ||
"version": "6.7.0", | ||
"description": "A wrapper for the Ruby version of Pact to work within Node", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
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
389881
6765