Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const path = require('path');
const Pact = require('@pact-foundation/pact').Pact;
global.port = 8080;
global.provider = new Pact({
cors: true,
port: global.port,
log: path.resolve(process.cwd(), 'logs', 'pact.log'),
loglevel: 'debug',
dir: path.resolve(process.cwd(), 'pacts'),
spec: 2,
pactfileWriteMode: 'update',
consumer: 'hero-consumer',
provider: 'hero-provider',
host: '127.0.0.1'
});
const path = require("path");
const Pact = require("@pact-foundation/pact").Pact;
global.__basedir = __dirname;
global.port = 3333;
global.provider = new Pact({
cors: true,
port: global.port,
log: path.resolve(process.cwd(), "logs", "pact-api.log"),
loglevel: "debug",
dir: path.resolve(process.cwd(), "pacts"),
spec: 2,
pactfileWriteMode: "merge",
consumer: "kotsadm-web",
provider: "kotsadm-api",
host: "127.0.0.1"
});
const path = require("path")
const Pact = require("@pact-foundation/pact").Pact
global.port = 8991
global.provider = new Pact({
port: global.port,
log: path.resolve(process.cwd(), "logs", "mockserver-integration.log"),
dir: path.resolve(process.cwd(), "pacts"),
spec: 2,
pactfileWriteMode: "update",
consumer: "MyConsumer",
provider: "MyProvider",
})
describe("GraphQL example", () => {
const provider = new Pact({
port: 4000,
log: path.resolve(process.cwd(), "logs", "mockserver-integration.log"),
dir: path.resolve(process.cwd(), "pacts"),
consumer: "GraphQLConsumer",
provider: "GraphQLProvider",
})
before(() => provider.setup())
after(() => provider.finalize())
describe("query hello on /graphql", () => {
before(() => {
const graphqlQuery = new GraphQLInteraction()
.uponReceiving("a hello request")
.withQuery(
`
const path = require('path');
const { Pact } = require('@pact-foundation/pact');
const pkg = require('../package.json');
global.port = 8989;
global.PACT_BASE_URL = `http://localhost:${port}`;
global.provider = new Pact({
port: global.port,
log: path.resolve(process.cwd(), 'logs', 'mockserver-integration.log'),
dir: path.resolve(process.cwd(), 'pacts'),
spec: 2,
logLevel: 'fatal',
pactfileWriteMode: 'update',
consumer: pkg.name,
provider: 'GitHub.com'
});