sasank kumar
12/25/2022, 2:48 AMAnthony Bennett
12/27/2022, 8:20 PMPaweł Szczerbicki
12/29/2022, 1:28 PMdist
folder on GithubActions CI, and also Pack JSON files on pact
folder. How do you share those JSON files between repositories in Github ? You are using releases or some other method ?Will Herring
01/05/2023, 11:18 AM2023-01-05T10:38:01.611240928Z
, and the pact-js docs require a format string to match against in java simple date format. I’m currently using the format string yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
Where I believe SSS is just meant to represent milliseconds in general. However this returns an error from the verifier that reads Error(Nom("171690Z", Tag))
. If I update the format string to include 9 S’s, to represent the amount of milliseconds we return in the response, I then get the error Error(InvalidMillisecond("294910091"))
. Does anyone have any idea how I could alter my format string to get it working? To add, it seems like java SimpleDateTime doesn’t handle nanoseconds, so I’m wondering if my next best solution is to just write a regex for it instead.Édouard Lopez
01/09/2023, 11:45 AMChris Aguirre
01/09/2023, 6:43 PMAbhishek
01/10/2023, 12:09 AMRobin Smit
01/12/2023, 1:08 PMAron L.
01/13/2023, 2:26 AMv3
and v4
folders - what are versions 3 and 4? and if im just starting out, should i be looking at those examples or can i safely use the examples in jest
?Édouard Lopez
01/16/2023, 11:39 AMstateHandlers
map. The following:
import { …, StateHandlers } from '@pact-foundation/pact'
…
stateHandlers: {
'Customers are available': (state, params) => Promise.resolve(),
} as StateHandlers,
Give this error
Type 'StateHandlers' is not assignable to type 'StateHandlers & StateHandlers'.
Type 'import("/workspaces/ms.pact-provider-example-for-typescript/node_modules/@pact-foundation/pact/src/dsl/message").StateHandlers' is not assignable to type 'import("/workspaces/ms.pact-provider-example-for-typescript/node_modules/@pact-foundation/pact/src/dsl/verifier/proxy/types").StateHandlers'.
'string' index signatures are incompatible.
Type '(state: string, params?: { [name: string]: string; } | undefined) => Promise<unknown>' is not assignable to type 'StateHandler'.
Type '(state: string, params?: { [name: string]: string; } | undefined) => Promise<unknown>' is not assignable to type 'StateFunc'.
Types of parameters 'state' and 'parameters' are incompatible.
Type 'AnyJson | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.ts(2322)
types.d.ts(42, 5): The expected type comes from property 'stateHandlers' which is declared here on type 'VerifierOptions'
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
state
is not a property in StateFunc
or StateFuncWithSetup
. The state is the key to the function.
so:
stateHandlers: {
'Customers are available': (params) => Promise.resolve(),
} as StateHandlers,
Should work.
If you don’t need the params, that’s optional alsoamanda stecz
01/16/2023, 9:51 PMYair Shkedi
01/18/2023, 10:22 AMimport { Matchers, MessageConsumerPact, asynchronousBodyHandler } from '@pact-foundation/pact';
import { work } from '../../../../../src/amqp/port/update-ds-risk-tag.port';
import * as dsRiskTagsUpdaterService from '../../../../../src/services/risk/tag/ds/ds-risk-tags-updater.service';
const { like } = Matchers;
import * as sinon from 'sinon';
const path = require('path');
describe('"orchestrator - data-catalog" - Msg Contract Test', () => {
const messagePact = new MessageConsumerPact({
consumer: 'orchestrator',
dir: path.resolve(process.cwd(), 'test/unit-tests/contractTests/pacts'),
log: path.resolve(process.cwd(), 'test/unit-tests/contractTests/logs', 'orch-data-catalog-msg-pact.log'),
provider: 'data-catalog-msg',
logLevel: 'info',
});
let sandbox;
before(function () {
sandbox = sinon.createSandbox();
sandbox.stub(dsRiskTagsUpdaterService, 'updateDsRiskTags').resolves();
});
after(function () {
sandbox.restore();
});
it('accepts an update of data source risk tags', () => {
return messagePact
.expectsToReceive('a product event update')
.withContent({
dsName: like('data source name'),
})
.withMetadata({
'content-type': 'application/json',
topic: 'catalog.object.update.ds.risk.object.routingKey',
})
.verify(asynchronousBodyHandler(work));
});
});
I want to upgrade to get new features, but it blocks me to upgrade.Édouard Lopez
01/18/2023, 4:16 PM…
: RuleList { rules: [MinType(2)], rule_logic: And, cascaded: false }, DocPath { path_tokens: [Root, Field("customer")], expr: "$.customer" }: RuleList { rules: [Regex("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")], rule_logic: And, cascaded: false }, DocPath { path_tokens: [Root, Field("orders"), StarIndex, Field("quantity")], expr: "$.orders[*].quantity" }: RuleList { rules: [Integer, Integer], rule_logic: And, cascaded: false }, DocPath { path_tokens: [Root, Field("orders"), StarIndex, Field("id")], expr: "$.orders[*].id" }: RuleList { rules: [Type, Type], rule_logic: And, cascaded: false }} }} }, generators: Generators { categories: {} } } }], metadata: {"pact-js": {"version": "10.4.0"}, "pactRust": {"ffi": "0.3.19", "models": "1.0.3"}, "pactSpecification": {"version": "3.0.0"}}, specification_version: V3 } options=VerificationOptions { request_filter: None, disable_ssl_verification: false, request_timeout: 30000, custom_headers: {}, coloured_output: true, no_pacts_is_error: true } provider_state_executor=HttpRequestProviderStateExecutor { state_change_url: Some("<http://127.0.0.1:38441/_pactSetup>"), state_change_teardown: true, state_change_body: true, reties: 3 }}: pact_verifier: Running teardown provider state change handler 'Customers orders are available' for 'A request for API customer-orders'
2023-01-18T16:11:19.194467Z WARN ThreadId(09) pact_matching::metrics:
Please note:
We are tracking events anonymously to gather important usage statistics like Pact version and operating system. To disable tracking, set the 'PACT_DO_NOT_TRACK' environment variable to 'true'.
Paul Hill
01/18/2023, 5:02 PMRobin Smit
01/20/2023, 1:59 PMnpm ERR! code 1
npm ERR! path /builds/x/x/node_modules/@pact-foundation/pact-core
npm ERR! command failed
npm ERR! command sh -c -- node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.1.0
npm ERR! gyp info using node@18.8.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3"
npm ERR! gyp http GET <https://nodejs.org/download/release/v18.8.0/node-v18.8.0-headers.tar.gz>
npm ERR! gyp WARN install got an error, rolling back install
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack FetchError: request to <https://nodejs.org/download/release/v18.8.0/node-v18.8.0-headers.tar.gz> failed, reason: connect ETIMEDOUT x:443
npm ERR! gyp ERR! stack at ClientRequest.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:130:14)
npm ERR! gyp ERR! stack at ClientRequest.emit (node:events:513:28)
npm ERR! gyp ERR! stack at TLSSocket.socketErrorListener (node:_http_client:494:9)
npm ERR! gyp ERR! stack at TLSSocket.emit (node:events:525:35)
npm ERR! gyp ERR! stack at emitErrorNT (node:internal/streams/destroy:151:8)
npm ERR! gyp ERR! stack at emitErrorCloseNT (node:internal/streams/destroy:116:3)
npm ERR! gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
npm ERR! gyp ERR! System Linux 5.4.0-135-generic
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /builds/x/x/node_modules/@pact-foundation/pact-core
npm ERR! gyp ERR! node -v v18.8.0
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok
Paul Hill
01/24/2023, 4:05 PMIvan Mikhalka
01/26/2023, 2:29 PMwillRespondWith: {
……
objectN: {
fieldC: "valueC",
fieldA: "valueA",
fieldB: "valueB"
}
……
}
When contract file generated, it appears be sorted in alphabetical order in contract file:
response: {
……
objectN: {
fieldA: "valueA",
fieldB: "valueB",
fieldC: "valueC"
}
……
}
When verifying provider, it fails on verification of objectN
. I cannot find any mismatches, except order of fields in objectN
.
Could someone help and explain me this? For example, if I want generated response body fields to be in same order as I defined?
One of the latest versions of @pact_foundation_greet/pact
in use ("@pact-foundation/pact": "^10.4.1"
in package.json
).Dmitry Munda
01/26/2023, 3:16 PMincludeWipPactsSince: isCI ? new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().split("T")[0] : undefined,
throws TypeError: includeWipPactsSince
doesnt work properly in non-CI env, with any of undefined/null/“”
any ideas ?Carere
01/29/2023, 3:48 PMpact-broker
)
Is there a way to launch can-i-deploy
and publish
pact task with npm / yarn / pnpm nowadays ?? Or do I need to go with another (or a better) option ??Carere
01/30/2023, 3:25 PMPactV4
when writing consumer test, should I use it ? Or should I stick to PactV3
?Carere
01/30/2023, 6:15 PMMatcher<string>
wen defining the form of the query. Did I miss something ?chiara pascucci
01/31/2023, 9:44 AMHarry
01/31/2023, 10:11 AMSSh
01/31/2023, 12:27 PMimport {MessageConsumerPact, synchronousBodyHandler} from "@pact-foundation/pact"
import {uuid} from "@pact-foundation/pact/src/dsl/matchers"
it("uuid", async () => {
return new MessageConsumerPact({
consumer: "consumer",
provider: "provider",
})
.expectsToReceive("uuid")
.withContent({
uuid: uuid("cc85f093-abe3-48d8-b187-32439d5b763e"),
})
.verify(synchronousBodyHandler(async () => new Promise((resolve) => {
resolve("OK")
})))
})
but this (use uuid from v3 package)
import {MessageConsumerPact, synchronousBodyHandler} from "@pact-foundation/pact"
import {uuid} from "@pact-foundation/pact/src/v3/matchers"
it("uuid", async () => {
return new MessageConsumerPact({
consumer: "consumer",
provider: "provider",
})
.expectsToReceive("uuid")
.withContent({
uuid: uuid("cc85f093-abe3-48d8-b187-32439d5b763e"),
})
.verify(synchronousBodyHandler(async () => new Promise((resolve) => {
resolve("OK")
})))
})
throw error like this
TS2345: Argument of type '{ uuid: RegexMatcher; }' is not assignable to parameter of type 'AnyTemplate'. Types of property 'uuid' are incompatible. Type 'RegexMatcher' is not assignable to type 'string | number | boolean | JsonArray | JsonMap | Matcher<AnyTemplate> | ArrayMatcher<AnyTemplate> | TemplateMap | ArrayTemplate'. Type 'RegexMatcher' is not assignable to type 'TemplateMap'. Index signature for type 'string' is missing in type 'RegexMatcher'.
amanda stecz
01/31/2023, 7:29 PMsasank kumar
02/01/2023, 1:24 AMsasank kumar
02/01/2023, 4:54 AMSushant Soni
02/07/2023, 1:07 PM