Skip to content

Commit

Permalink
fix: All options are now passed down to pact-core in consumer pacts, …
Browse files Browse the repository at this point in the history
…allowing usage of the undocumented `monkeypatch` option

fix: All options are now passed down to pact-core in consumer pacts, allowing usage of the undocumented `monkeypatch` option
  • Loading branch information
TimothyJones authored Jan 12, 2022
2 parents 4b9486d + b40eee9 commit 50f00b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/httpPact.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe("Pact", () => {
spec: 2,
cors: false,
pactfileWriteMode: "overwrite",
monkeypatch: "/path/to/monkeypatch.rb",
} as PactOptionsComplete

before(() => {
Expand Down Expand Up @@ -140,6 +141,7 @@ describe("Pact", () => {
spec: 2,
cors: false,
pactfileWriteMode: "overwrite",
monkeypatch: "/path/to/monkeypatch.rb",
})
})
})
Expand Down
18 changes: 4 additions & 14 deletions src/httpPact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { isPortAvailable } from "./common/net"
import logger, { traceHttpInteractions, setLogLevel } from "./common/logger"
import { MockService } from "./dsl/mockService"
import { LogLevel, PactOptions, PactOptionsComplete } from "./dsl/options"
import { Server } from "@pact-foundation/pact-node/src/server"
import { Server, ServerOptions } from "@pact-foundation/pact-node/src/server"
import VerificationError from "./errors/verificationError"
import ConfigurationError from "./errors/configurationError"

Expand Down Expand Up @@ -278,19 +278,9 @@ export class Pact {

private createServer(config: PactOptions) {
this.server = serviceFactory.createServer({
consumer: this.opts.consumer,
cors: this.opts.cors,
dir: this.opts.dir,
host: this.opts.host,
log: this.opts.log,
pactFileWriteMode: this.opts.pactfileWriteMode,
timeout: 30000,
...this.opts,
port: config.port, // allow to be undefined
provider: this.opts.provider,
spec: this.opts.spec,
ssl: this.opts.ssl,
sslcert: this.opts.sslcert,
sslkey: this.opts.sslkey,
timeout: this.opts.timeout || 30000,
})
} as ServerOptions)
}
}

0 comments on commit 50f00b4

Please sign in to comment.