@pact-foundation/pact-node
Advanced tools
Comparing version 4.1.0 to 4.1.1
{ | ||
"name": "@pact-foundation/pact-node", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "A wrapper for the Ruby version of Pact to work within Node", | ||
@@ -85,6 +85,7 @@ "main": "./src/pact.js", | ||
"lint": "jscs .", | ||
"test": "./node_modules/.bin/cross-env DEVELOPMENT=true mocha -R spec ./**/*.spec.js --timeout 15000", | ||
"pretest": "npm run clean && npm run lint", | ||
"test": "./node_modules/.bin/cross-env ENABLE_LOG=true mocha ./**/*.spec.js", | ||
"watch": "nodemon -x npm run dev", | ||
"watch:debug": "nodemon --debug -q -w assets/ --ext '.' --exec 'npm run lint'", | ||
"dev": "npm run clean && npm run lint --force && npm test && ./node_modules/.bin/cross-env DEVELOPMENT=true node .", | ||
"dev": "npm test && ./node_modules/.bin/cross-env node .", | ||
"start": "npm run watch" | ||
@@ -91,0 +92,0 @@ }, |
@@ -23,3 +23,3 @@ <img src="https://raw.githubusercontent.com/pact-foundation/pact-logo/master/media/logo-black.png" width="200"> | ||
var pact = require('@pact-foundation/pact-node'); | ||
var server = pact.create({port: 9999}); | ||
var server = pact.createServer({port: 9999}); | ||
server.start().then(function() { | ||
@@ -26,0 +26,0 @@ // Do your testing/development here |
@@ -6,11 +6,9 @@ var bunyan = require('bunyan'), | ||
prettyStdOut = new PrettyStream(); | ||
prettyStdOut.pipe(process.stdout); | ||
var config = { | ||
module.exports = bunyan.createLogger({ | ||
name: 'pact-node@' + pkg.version, | ||
streams: [ | ||
{ | ||
level: 'info', | ||
level: 'warn', | ||
type: 'raw', | ||
@@ -20,4 +18,2 @@ stream: prettyStdOut | ||
] | ||
}; | ||
module.exports = bunyan.createLogger(config); | ||
}); |
@@ -15,3 +15,3 @@ 'use strict'; | ||
.pairs() | ||
.map(function(v){ | ||
.map(function (v) { | ||
return v.join(' = '); | ||
@@ -18,0 +18,0 @@ }) |
@@ -6,3 +6,3 @@ /* global describe:true, before:true, after:true, it:true, global:true, process:true */ | ||
logger = require('./logger.js'), | ||
path = require('path'); | ||
path = require('path'), | ||
chai = require("chai"), | ||
@@ -15,6 +15,6 @@ chaiAsPromised = require("chai-as-promised"), | ||
describe("Pact Spec", function () { | ||
before(function(){ | ||
before(function() { | ||
logger.level('debug'); | ||
}); | ||
afterEach(function (done) { | ||
@@ -21,0 +21,0 @@ pact.removeAllServers().then(function () { |
@@ -52,8 +52,8 @@ 'use strict'; | ||
var putUrl = this.options.pactBroker + '/pacts/provider/' + provider + '/consumer/' + consumer + '/version/' + this.options.consumerVersion; | ||
var req = request | ||
.put(putUrl) | ||
.send(data) | ||
.set('Content-Type', 'application/json') | ||
.set('Accept', 'application/json'); | ||
var putUrl = this.options.pactBroker + '/pacts/provider/' + provider + '/consumer/' + consumer + '/version/' + this.options.consumerVersion; | ||
var req = request | ||
.put(putUrl) | ||
.send(data) | ||
.set('Content-Type', 'application/json') | ||
.set('Accept', 'application/json'); | ||
@@ -90,3 +90,3 @@ // Authentication | ||
_.each(options.pactUrls, function(uri) { | ||
// only check local files | ||
// only check local files | ||
var proto = url.parse(uri).protocol; | ||
@@ -96,3 +96,3 @@ if (proto == 'file://' || proto === null) { | ||
fs.statSync(path.normalize(uri)) | ||
} catch(e) { | ||
} catch (e) { | ||
throw new Error('Pact file or directory: "' + uri + '" doesn\'t exist'); | ||
@@ -115,3 +115,3 @@ } | ||
if ( (options.pactBrokerUsername && !options.pactBrokerPassword) || (options.pactBrokerPassword && !options.pactBrokerUsername)) { | ||
if ((options.pactBrokerUsername && !options.pactBrokerPassword) || (options.pactBrokerPassword && !options.pactBrokerUsername)) { | ||
throw new Error('Must provide both or none of --provider-states-url and --provider-states-setup-url.'); | ||
@@ -118,0 +118,0 @@ } |
@@ -27,6 +27,2 @@ /* global describe:true, before:true, after:true, it:true, global:true, process:true */ | ||
afterEach(function (done) { | ||
done(); | ||
}); | ||
describe("Publisher", function () { | ||
@@ -33,0 +29,0 @@ context("when not given pactUrls", function () { |
@@ -269,3 +269,3 @@ 'use strict'; | ||
// dir check | ||
if(!fs.statSync(path.normalize(options.dir)).isDirectory()) { | ||
if (!fs.statSync(path.normalize(options.dir)).isDirectory()) { | ||
// If directory doesn't exist, create it | ||
@@ -272,0 +272,0 @@ } |
@@ -10,3 +10,3 @@ /* global describe:true, before:true, after:true, it:true, global:true, process:true */ | ||
rewire = require("rewire"), | ||
verifier = rewire("./verifier.js"); | ||
verifier = rewire("./verifier.js"), | ||
chaiAsPromised = require("chai-as-promised"); | ||
@@ -22,6 +22,2 @@ | ||
afterEach(function (done) { | ||
done(); | ||
}); | ||
describe("Verifier", function () { | ||
@@ -28,0 +24,0 @@ context("when not given --pact-urls or --provider-base-url", function () { |
@@ -49,4 +49,3 @@ var cors = require('cors'), | ||
res.status(err.status).end(); | ||
} | ||
else { | ||
} else { | ||
console.log('Sent:', fileName); | ||
@@ -53,0 +52,0 @@ } |
@@ -21,3 +21,2 @@ /* global describe:true, before:true, after:true, it:true, global:true, process:true */ | ||
before(function (done) { | ||
logger.level('debug'); | ||
server = broker.listen(PORT, function () { | ||
@@ -24,0 +23,0 @@ console.log('Pact Broker Mock listening on port: ' + PORT); |
@@ -25,3 +25,2 @@ /* global describe:true, before:true, after:true, it:true, global:true, process:true */ | ||
before(function (done) { | ||
logger.level('debug'); | ||
server = provider.listen(PORT, function () { | ||
@@ -143,3 +142,3 @@ console.log('Pact Broker Mock listening on port: ' + PORT); | ||
}); | ||
return expect(verifier.verify().catch( function(err) { | ||
return expect(verifier.verify().catch(function(err) { | ||
if (!_.isEmpty(err)) { | ||
@@ -146,0 +145,0 @@ return Promise.reject(new Error("failed")); |
35
84220
1998