How to use the @pact-foundation/pact-node.create 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 pact-foundation / pact-js / pact-mocha-interface / src / index.js View on Github external
suite.on('pre-require', function (context, file, mocha) {
    var common = require('mocha/lib/interfaces/common')(suites, context)

    context.beforeEach = common.beforeEach
    context.afterEach = common.afterEach
    context.run = mocha.options.delay && common.runWithSuite(suite)

    var mockServer = wrapper.create({
      port: 1234,
      log: path.resolve(process.cwd(), 'logs', 'mockserver.log'),
      dir: path.resolve(process.cwd(), 'pacts'),
      spec: 2
    })

    context.Pact = function (consumer, provider, providerURL, fn) {
      var pactSuite = Suite.create(suites[0], `Pact ${consumer} <=> ${provider}`)
      pactSuite.file = file

      pactSuite.pactConsumer = consumer
      pactSuite.pactProvider = provider

      pactSuite.pact = Pact.Verifier({ consumer: consumer, provider: provider })

      suites.unshift(pactSuite)
github pact-foundation / pact-js / src / pact-mocha-interface / pact-ui.js View on Github external
suite.on('pre-require', (context, file, mocha) => {
    var common = require('mocha/lib/interfaces/common')(suites, context)
    context.run = mocha.options.delay && common.runWithSuite(suite)

    const mockServer = wrapper.create({
      port: 1234,
      log: path.resolve(process.cwd(), 'logs', 'mockserver.log'),
      dir: path.resolve(process.cwd(), 'pacts'),
      spec: 2
    })

    context.Pact = (consumer, provider, providerURL, fn) => {
      const pactSuite = Suite.create(suites[0], `Pact ${consumer} <=> ${provider}`)
      pactSuite.file = file

      pactSuite.pactConsumer = consumer
      pactSuite.pactProvider = provider

      pactSuite.pact = Pact({ consumer, provider })
      pactSuite.pact.intercept(providerURL)

@pact-foundation/pact-node

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

MIT
Latest version published 2 months ago

Package Health Score

81 / 100
Full package analysis