How to use the @pact-foundation/pact-node.publishPacts function in @pact-foundation/pact-node

To help you get started, we’ve selected a few @pact-foundation/pact-node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kyle-ssg / nextjs-redux / tests / pact / helpers / pact.publish.js View on Github external
const pact = require('@pact-foundation/pact-node');
const path = require('path');

require('dotenv').config();

if (process.env.PACT_BROKER) {
    const opts = {
        pactFilesOrDirs: [path.resolve(__dirname, `../../../pacts/${namespace}.json`)],
        pactBroker: process.env.PACT_BROKER,
        pactBrokerUsername: process.env.PACT_BROKER_USERNAME,
        pactBrokerPassword: process.env.PACT_BROKER_PASSWORD,
        tags: ['prod', 'test'],
        consumerVersion: `${process.env.CI_COMMIT_REF_NAME || 'local'}.${Math.floor(new Date() / 1000)}`,
    };

    pact.publishPacts(opts)
        .then(() => {
        })
        .catch(() => {
        });
} else {
    console.log('Skipping pact publish, no PACT_BROKER env variable found!');
}
github thombergs / code-examples / pact / pact-node-messages / pact / publish.js View on Github external
let publisher = require('@pact-foundation/pact-node');
let path = require('path');

let opts = {
    pactFilesOrDirs: [path.resolve(process.cwd(), 'pacts')],
    pactBroker: 'https://adesso.pact.dius.com.au/',
    pactBrokerUsername: process.env.PACT_USERNAME,
    pactBrokerPassword: process.env.PACT_PASSWORD,
    consumerVersion: '2.0.0'
};

publisher.publishPacts(opts).then(() => console.log("Pacts successfully published"));
github thombergs / code-examples / pact / pact-angular / publish-pacts.js View on Github external
let project = require('./package.json');
let pactBrokerUrl = process.env.npm_package_config_brokerUrl;
let pactBrokerUsername = process.env.npm_package_config_brokerUsername;
let pactBrokerPassword = process.env.npm_package_config_brokerPassword;

let options = {
  pactFilesOrDirs: [projectFolder + '/pacts'],
  pactBroker: pactBrokerUrl,
  consumerVersion: project.version,
  tags: ['latest'],
  pactBrokerUsername: pactBrokerUsername,
  pactBrokerPassword: pactBrokerPassword
};


pact.publishPacts(options).then(function () {
  console.log("Pacts successfully published!");
});
github pact-foundation / pact-js / examples / messages / publish.js View on Github external
const pact = require('@pact-foundation/pact-node')
const path = require('path')
const opts = {
  pactFilesOrDirs: [path.resolve(__dirname, 'pacts/myjsmessageconsumer-myjsmessageprovider.json')],
  pactBroker: 'https://test.pact.dius.com.au',
  pactBrokerUsername: 'dXfltyFMgNOFZAxr8io9wJ37iUpY42M',
  pactBrokerPassword: 'O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1',
  tags: ['prod', 'test'],
  consumerVersion: '1.0.' + ((process.env.TRAVIS_BUILD_NUMBER) ? process.env.TRAVIS_BUILD_NUMBER : Math.floor(new Date() / 1000))
}

pact.publishPacts(opts)
  .then(() => {
    console.log('Pact contract publishing complete!')
    console.log('')
    console.log('Head over to https://test.pact.dius.com.au/ and login with')
    console.log('=> Username: dXfltyFMgNOFZAxr8io9wJ37iUpY42M')
    console.log('=> Password: O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1')
    console.log('to see your published contracts.')
  })
  .catch(e => {
    console.log('Pact contract publishing failed: ', e)
  })
github alphagov / pay-selfservice / bin / publish-pacts.js View on Github external
#!/usr/bin/env node
let pact = require('@pact-foundation/pact-node')
let opts = {
  pactFilesOrDirs: [`${__dirname}/../pacts/`],
  pactBroker: process.env.PACT_BROKER_URL,
  consumerVersion: process.env.PACT_CONSUMER_VERSION,
  pactBrokerUsername: process.env.PACT_BROKER_USERNAME,
  pactBrokerPassword: process.env.PACT_BROKER_PASSWORD,
  tags: process.env.PACT_CONSUMER_TAG
}

pact.publishPacts(opts).then(function () {
  console.log('>> Pact files have been published')
})
github alphagov / pay-frontend / bin / publish-pacts.js View on Github external
#!/usr/bin/env node
const pact = require('@pact-foundation/pact-node')
const opts = {
  pactFilesOrDirs: [`${__dirname}/../pacts/`],
  pactBroker: process.env.PACT_BROKER_URL,
  consumerVersion: process.env.PACT_CONSUMER_VERSION,
  pactBrokerUsername: process.env.PACT_BROKER_USERNAME,
  pactBrokerPassword: process.env.PACT_BROKER_PASSWORD,
  tags: process.env.PACT_CONSUMER_TAG
}

pact.publishPacts(opts).then(function () {
  console.log('>> Pact files have been published')
})
github kununu / pact-cli / src / commands.js View on Github external
function publishPacts (opts, args, config) {
  return pact.publishPacts(opts).then((pactObject) => {
    log('=================================================================================');
    log(`Pact ${args.PACT_FILE} Published on ${config.brokerUrl}`);
    log('=================================================================================');
    log(JSON.stringify(pactObject, null, 2));
    log('=================================================================================');
  }, (err) => log(`Publish failed because of \n${err}`));
}
github pact-foundation / pact-js / examples / jest / publish.js View on Github external
let publisher = require("@pact-foundation/pact-node")
let path = require("path")

let opts = {
  providerBaseUrl: "http://localhost:8080",
  pactFilesOrDirs: [path.resolve(process.cwd(), "pacts")],
  pactBroker: "https://localhost:3000",
  pactBrokerUsername: process.env.PACT_USERNAME,
  pactBrokerPassword: process.env.PACT_PASSWORD,
  consumerVersion: "2.0.0",
}

publisher.publishPacts(opts)

@pact-foundation/pact-node

Core of @pact-foundation/pact. You almost certainly don't want to depend on this directly.

MIT
Latest version published 8 months ago

Package Health Score

74 / 100
Full package analysis