@pact-foundation/pact 10.0.0-beta.9 → 10.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2444 -1
- package/CODE_OF_CONDUCT.md +1 -1
- package/CONTRIBUTING.md +49 -12
- package/MIGRATION.md +77 -0
- package/README.md +180 -1274
- package/RELEASING.md +63 -59
- package/package.json +95 -97
- package/src/common/jsonTypes.d.ts +5 -0
- package/src/common/jsonTypes.js +3 -0
- package/src/common/jsonTypes.js.map +1 -0
- package/src/common/logger.d.ts +10 -0
- package/src/common/logger.js +32 -0
- package/src/common/logger.js.map +1 -0
- package/src/common/net.d.ts +9 -0
- package/src/common/net.js +82 -0
- package/src/common/net.js.map +1 -0
- package/{common → src/common}/net.spec.d.ts +0 -0
- package/src/common/net.spec.js +69 -0
- package/src/common/net.spec.js.map +1 -0
- package/src/common/request.d.ts +21 -0
- package/src/common/request.js +110 -0
- package/src/common/request.js.map +1 -0
- package/{common → src/common}/request.spec.d.ts +0 -0
- package/src/common/request.spec.js +69 -0
- package/src/common/request.spec.js.map +1 -0
- package/src/common/spec.d.ts +2 -0
- package/src/common/spec.js +22 -0
- package/src/common/spec.js.map +1 -0
- package/{dsl → src/dsl}/apolloGraphql.d.ts +1 -1
- package/{dsl → src/dsl}/apolloGraphql.js +4 -1
- package/src/dsl/apolloGraphql.js.map +1 -0
- package/{dsl → src/dsl}/apolloGraphql.spec.d.ts +0 -0
- package/src/dsl/apolloGraphql.spec.js +74 -0
- package/src/dsl/apolloGraphql.spec.js.map +1 -0
- package/{dsl → src/dsl}/graphql.d.ts +19 -8
- package/{dsl → src/dsl}/graphql.js +59 -31
- package/src/dsl/graphql.js.map +1 -0
- package/{dsl → src/dsl}/graphql.spec.d.ts +0 -0
- package/src/dsl/graphql.spec.js +229 -0
- package/src/dsl/graphql.spec.js.map +1 -0
- package/{dsl → src/dsl}/interaction.d.ts +22 -20
- package/src/dsl/interaction.js +144 -0
- package/src/dsl/interaction.js.map +1 -0
- package/{dsl → src/dsl}/interaction.spec.d.ts +0 -0
- package/src/dsl/interaction.spec.js +214 -0
- package/src/dsl/interaction.spec.js.map +1 -0
- package/src/dsl/matchers.d.ts +143 -0
- package/{dsl → src/dsl}/matchers.js +92 -93
- package/src/dsl/matchers.js.map +1 -0
- package/{dsl → src/dsl}/matchers.spec.d.ts +0 -0
- package/src/dsl/matchers.spec.js +668 -0
- package/src/dsl/matchers.spec.js.map +1 -0
- package/{dsl → src/dsl}/message.d.ts +32 -12
- package/{dsl → src/dsl}/message.js +0 -0
- package/{dsl → src/dsl}/message.js.map +1 -1
- package/src/dsl/mockService.d.ts +13 -0
- package/src/dsl/mockService.js +3 -0
- package/src/dsl/mockService.js.map +1 -0
- package/{dsl → src/dsl}/options.d.ts +7 -6
- package/{dsl → src/dsl}/options.js +0 -0
- package/{dsl → src/dsl}/options.js.map +1 -1
- package/src/dsl/verifier/index.d.ts +1 -0
- package/src/dsl/verifier/index.js +18 -0
- package/src/dsl/verifier/index.js.map +1 -0
- package/src/dsl/verifier/proxy/hooks.d.ts +4 -0
- package/src/dsl/verifier/proxy/hooks.js +109 -0
- package/src/dsl/verifier/proxy/hooks.js.map +1 -0
- package/src/dsl/verifier/proxy/index.d.ts +1 -0
- package/src/dsl/verifier/proxy/index.js +18 -0
- package/src/dsl/verifier/proxy/index.js.map +1 -0
- package/src/dsl/verifier/proxy/parseBody.d.ts +7 -0
- package/src/dsl/verifier/proxy/parseBody.js +22 -0
- package/src/dsl/verifier/proxy/parseBody.js.map +1 -0
- package/{dsl/mockService.spec.d.ts → src/dsl/verifier/proxy/parseBody.spec.d.ts} +0 -0
- package/src/dsl/verifier/proxy/parseBody.spec.js +118 -0
- package/src/dsl/verifier/proxy/parseBody.spec.js.map +1 -0
- package/src/dsl/verifier/proxy/proxy.d.ts +4 -0
- package/src/dsl/verifier/proxy/proxy.js +92 -0
- package/src/dsl/verifier/proxy/proxy.js.map +1 -0
- package/{dsl/publisher.spec.d.ts → src/dsl/verifier/proxy/proxy.spec.d.ts} +0 -0
- package/src/dsl/verifier/proxy/proxy.spec.js +33 -0
- package/src/dsl/verifier/proxy/proxy.spec.js.map +1 -0
- package/src/dsl/verifier/proxy/stateHandler/index.d.ts +1 -0
- package/src/dsl/verifier/proxy/stateHandler/index.js +18 -0
- package/src/dsl/verifier/proxy/stateHandler/index.js.map +1 -0
- package/src/dsl/verifier/proxy/stateHandler/setupStates.d.ts +3 -0
- package/src/dsl/verifier/proxy/stateHandler/setupStates.js +48 -0
- package/src/dsl/verifier/proxy/stateHandler/setupStates.js.map +1 -0
- package/{dsl/verifier.spec.d.ts → src/dsl/verifier/proxy/stateHandler/setupStates.spec.d.ts} +0 -0
- package/src/dsl/verifier/proxy/stateHandler/setupStates.spec.js +191 -0
- package/src/dsl/verifier/proxy/stateHandler/setupStates.spec.js.map +1 -0
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.d.ts +3 -0
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.js +14 -0
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.js.map +1 -0
- package/{httpPact.spec.d.ts → src/dsl/verifier/proxy/stateHandler/stateHandler.spec.d.ts} +0 -0
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.spec.js +130 -0
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.spec.js.map +1 -0
- package/src/dsl/verifier/proxy/tracer.d.ts +3 -0
- package/src/dsl/verifier/proxy/tracer.js +52 -0
- package/src/dsl/verifier/proxy/tracer.js.map +1 -0
- package/src/dsl/verifier/proxy/types.d.ts +48 -0
- package/src/dsl/verifier/proxy/types.js +3 -0
- package/src/dsl/verifier/proxy/types.js.map +1 -0
- package/src/dsl/verifier/types.d.ts +3 -0
- package/src/dsl/verifier/types.js +3 -0
- package/src/dsl/verifier/types.js.map +1 -0
- package/src/dsl/verifier/verifier.d.ts +16 -0
- package/src/dsl/verifier/verifier.js +129 -0
- package/src/dsl/verifier/verifier.js.map +1 -0
- package/{messageConsumerPact.spec.d.ts → src/dsl/verifier/verifier.spec.d.ts} +0 -0
- package/src/dsl/verifier/verifier.spec.js +172 -0
- package/src/dsl/verifier/verifier.spec.js.map +1 -0
- package/{errors → src/errors}/configurationError.d.ts +0 -0
- package/{errors → src/errors}/configurationError.js +3 -1
- package/src/errors/configurationError.js.map +1 -0
- package/{errors → src/errors}/graphQLQueryError.d.ts +0 -0
- package/{errors → src/errors}/graphQLQueryError.js +3 -1
- package/src/errors/graphQLQueryError.js.map +1 -0
- package/{errors → src/errors}/matcherError.d.ts +0 -0
- package/{errors → src/errors}/matcherError.js +3 -1
- package/src/errors/matcherError.js.map +1 -0
- package/{errors → src/errors}/verificationError.d.ts +0 -0
- package/{errors → src/errors}/verificationError.js +3 -1
- package/src/errors/verificationError.js.map +1 -0
- package/src/httpPact/ffi.d.ts +15 -0
- package/src/httpPact/ffi.js +91 -0
- package/src/httpPact/ffi.js.map +1 -0
- package/{messageProviderPact.spec.d.ts → src/httpPact/ffi.spec.d.ts} +0 -0
- package/src/httpPact/ffi.spec.js +81 -0
- package/src/httpPact/ffi.spec.js.map +1 -0
- package/{httpPact.d.ts → src/httpPact/index.d.ts} +12 -12
- package/src/httpPact/index.js +311 -0
- package/src/httpPact/index.js.map +1 -0
- package/{pact-web.spec.d.ts → src/httpPact/index.spec.d.ts} +0 -0
- package/src/httpPact/index.spec.js +238 -0
- package/src/httpPact/index.spec.js.map +1 -0
- package/src/httpPact/tracing.d.ts +1 -0
- package/src/httpPact/tracing.js +53 -0
- package/src/httpPact/tracing.js.map +1 -0
- package/{pact.d.ts → src/index.d.ts} +22 -21
- package/src/index.js +107 -0
- package/src/index.js.map +1 -0
- package/src/messageConsumerPact.d.ts +86 -0
- package/src/messageConsumerPact.js +222 -0
- package/src/messageConsumerPact.js.map +1 -0
- package/src/messageConsumerPact.spec.d.ts +1 -0
- package/src/messageConsumerPact.spec.js +117 -0
- package/src/messageConsumerPact.spec.js.map +1 -0
- package/{messageProviderPact.d.ts → src/messageProviderPact.d.ts} +7 -4
- package/src/messageProviderPact.js +190 -0
- package/src/messageProviderPact.js.map +1 -0
- package/src/messageProviderPact.spec.d.ts +1 -0
- package/src/messageProviderPact.spec.js +183 -0
- package/src/messageProviderPact.spec.js.map +1 -0
- package/{pact.integration.spec.d.ts → src/pact.integration.spec.d.ts} +0 -0
- package/{pact.integration.spec.js → src/pact.integration.spec.js} +0 -0
- package/src/pact.integration.spec.js.map +1 -0
- package/src/v3/display.d.ts +6 -0
- package/src/v3/display.js +83 -0
- package/src/v3/display.js.map +1 -0
- package/src/v3/index.d.ts +17 -0
- package/src/v3/index.js +47 -0
- package/src/v3/index.js.map +1 -0
- package/src/v3/matchers.d.ts +182 -0
- package/src/v3/matchers.js +443 -0
- package/src/v3/matchers.js.map +1 -0
- package/src/v3/matchers.spec.d.ts +1 -0
- package/src/v3/matchers.spec.js +461 -0
- package/src/v3/matchers.spec.js.map +1 -0
- package/src/v3/pact.d.ts +21 -0
- package/src/v3/pact.js +240 -0
- package/src/v3/pact.js.map +1 -0
- package/src/v3/types.d.ts +81 -0
- package/src/v3/types.js +11 -0
- package/src/v3/types.js.map +1 -0
- package/{v3 → src/v3}/xml/xmlBuilder.d.ts +2 -2
- package/{v3 → src/v3}/xml/xmlBuilder.js +2 -1
- package/src/v3/xml/xmlBuilder.js.map +1 -0
- package/src/v3/xml/xmlElement.d.ts +27 -0
- package/{v3 → src/v3}/xml/xmlElement.js +21 -15
- package/src/v3/xml/xmlElement.js.map +1 -0
- package/src/v3/xml/xmlElement.spec.d.ts +1 -0
- package/src/v3/xml/xmlElement.spec.js +102 -0
- package/src/v3/xml/xmlElement.spec.js.map +1 -0
- package/{v3 → src/v3}/xml/xmlNode.d.ts +0 -0
- package/{v3 → src/v3}/xml/xmlNode.js +1 -0
- package/src/v3/xml/xmlNode.js.map +1 -0
- package/src/v3/xml/xmlText.d.ts +7 -0
- package/{v3 → src/v3}/xml/xmlText.js +4 -1
- package/src/v3/xml/xmlText.js.map +1 -0
- package/test/helper.d.ts +1 -0
- package/test/helper.js +37 -0
- package/test/helper.js.map +1 -0
- package/ROADMAP.md +0 -20
- package/common/logger.d.ts +0 -7
- package/common/logger.js +0 -56
- package/common/logger.js.map +0 -1
- package/common/metadata.d.ts +0 -0
- package/common/metadata.js +0 -2
- package/common/metadata.js.map +0 -1
- package/common/net.d.ts +0 -9
- package/common/net.js +0 -48
- package/common/net.js.map +0 -1
- package/common/net.spec.js +0 -67
- package/common/net.spec.js.map +0 -1
- package/common/request.d.ts +0 -14
- package/common/request.js +0 -47
- package/common/request.js.map +0 -1
- package/common/request.spec.js +0 -71
- package/common/request.spec.js.map +0 -1
- package/common/utils.d.ts +0 -2
- package/common/utils.js +0 -10
- package/common/utils.js.map +0 -1
- package/dsl/apolloGraphql.js.map +0 -1
- package/dsl/apolloGraphql.spec.js +0 -47
- package/dsl/apolloGraphql.spec.js.map +0 -1
- package/dsl/graphql.js.map +0 -1
- package/dsl/graphql.spec.js +0 -150
- package/dsl/graphql.spec.js.map +0 -1
- package/dsl/interaction.js +0 -112
- package/dsl/interaction.js.map +0 -1
- package/dsl/interaction.spec.js +0 -217
- package/dsl/interaction.spec.js.map +0 -1
- package/dsl/matchers.d.ts +0 -269
- package/dsl/matchers.js.map +0 -1
- package/dsl/matchers.spec.js +0 -563
- package/dsl/matchers.spec.js.map +0 -1
- package/dsl/mockService.d.ts +0 -58
- package/dsl/mockService.js +0 -74
- package/dsl/mockService.js.map +0 -1
- package/dsl/mockService.spec.js +0 -126
- package/dsl/mockService.spec.js.map +0 -1
- package/dsl/publisher.d.ts +0 -6
- package/dsl/publisher.js +0 -19
- package/dsl/publisher.js.map +0 -1
- package/dsl/publisher.spec.js +0 -21
- package/dsl/publisher.spec.js.map +0 -1
- package/dsl/verifier.d.ts +0 -39
- package/dsl/verifier.js +0 -173
- package/dsl/verifier.js.map +0 -1
- package/dsl/verifier.spec.js +0 -299
- package/dsl/verifier.spec.js.map +0 -1
- package/errors/configurationError.js.map +0 -1
- package/errors/graphQLQueryError.js.map +0 -1
- package/errors/matcherError.js.map +0 -1
- package/errors/verificationError.js.map +0 -1
- package/httpPact.js +0 -206
- package/httpPact.js.map +0 -1
- package/httpPact.spec.js +0 -337
- package/httpPact.spec.js.map +0 -1
- package/messageConsumerPact.d.ts +0 -67
- package/messageConsumerPact.js +0 -161
- package/messageConsumerPact.js.map +0 -1
- package/messageConsumerPact.spec.js +0 -161
- package/messageConsumerPact.spec.js.map +0 -1
- package/messageProviderPact.js +0 -139
- package/messageProviderPact.js.map +0 -1
- package/messageProviderPact.spec.js +0 -143
- package/messageProviderPact.spec.js.map +0 -1
- package/pact-web.d.ts +0 -100
- package/pact-web.js +0 -151
- package/pact-web.js.map +0 -1
- package/pact-web.spec.js +0 -191
- package/pact-web.spec.js.map +0 -1
- package/pact.integration.spec.js.map +0 -1
- package/pact.js +0 -74
- package/pact.js.map +0 -1
- package/v3/index.d.ts +0 -23
- package/v3/index.js +0 -33
- package/v3/index.js.map +0 -1
- package/v3/matchers.d.ts +0 -199
- package/v3/matchers.js +0 -305
- package/v3/matchers.js.map +0 -1
- package/v3/pact.d.ts +0 -47
- package/v3/pact.js +0 -101
- package/v3/pact.js.map +0 -1
- package/v3/verifier.d.ts +0 -27
- package/v3/verifier.js +0 -46
- package/v3/verifier.js.map +0 -1
- package/v3/xml/xmlBuilder.js.map +0 -1
- package/v3/xml/xmlElement.d.ts +0 -34
- package/v3/xml/xmlElement.js.map +0 -1
- package/v3/xml/xmlNode.js.map +0 -1
- package/v3/xml/xmlText.d.ts +0 -6
- package/v3/xml/xmlText.js.map +0 -1
package/v3/matchers.d.ts
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Value must match the given template
|
|
3
|
-
* @param template Template to base the comparison on
|
|
4
|
-
*/
|
|
5
|
-
export declare function like(template: any): {
|
|
6
|
-
"pact:matcher:type": string;
|
|
7
|
-
value: any;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Array where each element must match the given template
|
|
11
|
-
* @param template Template to base the comparison on
|
|
12
|
-
*/
|
|
13
|
-
export declare function eachLike(template: any): {
|
|
14
|
-
"pact:matcher:type": string;
|
|
15
|
-
value: any[];
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* An array that has to have at least one element and each element must match the given template
|
|
19
|
-
* @param template Template to base the comparison on
|
|
20
|
-
* @param count Number of examples to generate, defaults to one
|
|
21
|
-
*/
|
|
22
|
-
export declare function atLeastOneLike(template: any, count?: number): {
|
|
23
|
-
min: number;
|
|
24
|
-
"pact:matcher:type": string;
|
|
25
|
-
value: any[];
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* An array that has to have at least the required number of elements and each element must match the given template
|
|
29
|
-
* @param template Template to base the comparison on
|
|
30
|
-
* @param min Minimum number of elements required in the array
|
|
31
|
-
* @param count Number of examples to generate, defaults to one
|
|
32
|
-
*/
|
|
33
|
-
export declare function atLeastLike(template: any, min: number, count?: number): {
|
|
34
|
-
min: number;
|
|
35
|
-
"pact:matcher:type": string;
|
|
36
|
-
value: any[];
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* An array that has to have at most the required number of elements and each element must match the given template
|
|
40
|
-
* @param template Template to base the comparison on
|
|
41
|
-
* @param max Maximum number of elements required in the array
|
|
42
|
-
* @param count Number of examples to generate, defaults to one
|
|
43
|
-
*/
|
|
44
|
-
export declare function atMostLike(template: any, max: number, count?: number): {
|
|
45
|
-
max: number;
|
|
46
|
-
"pact:matcher:type": string;
|
|
47
|
-
value: any[];
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* An array whose size is constrained to the minimum and maximum number of elements and each element must match the given template
|
|
51
|
-
* @param template Template to base the comparison on
|
|
52
|
-
* @param min Minimum number of elements required in the array
|
|
53
|
-
* @param max Maximum number of elements required in the array
|
|
54
|
-
* @param count Number of examples to generate, defaults to one
|
|
55
|
-
*/
|
|
56
|
-
export declare function constrainedArrayLike(template: any, min: number, max: number, count?: number): {
|
|
57
|
-
min: number;
|
|
58
|
-
max: number;
|
|
59
|
-
"pact:matcher:type": string;
|
|
60
|
-
value: any[];
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Value must be a boolean
|
|
64
|
-
* @param b Boolean example value
|
|
65
|
-
*/
|
|
66
|
-
export declare function boolean(b: boolean): {
|
|
67
|
-
"pact:matcher:type": string;
|
|
68
|
-
value: boolean;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Value must be an integer (must be a number and have no decimal places)
|
|
72
|
-
* @param int Example value. If omitted a random value will be generated.
|
|
73
|
-
*/
|
|
74
|
-
export declare function integer(int?: number): {
|
|
75
|
-
"pact:matcher:type": string;
|
|
76
|
-
value: number;
|
|
77
|
-
"pact:generator:type"?: undefined;
|
|
78
|
-
} | {
|
|
79
|
-
"pact:generator:type": string;
|
|
80
|
-
"pact:matcher:type": string;
|
|
81
|
-
value: number;
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Value must be a decimal number (must be a number and have decimal places)
|
|
85
|
-
* @param num Example value. If omitted a random value will be generated.
|
|
86
|
-
*/
|
|
87
|
-
export declare function decimal(num?: number): {
|
|
88
|
-
"pact:matcher:type": string;
|
|
89
|
-
value: number;
|
|
90
|
-
"pact:generator:type"?: undefined;
|
|
91
|
-
} | {
|
|
92
|
-
"pact:generator:type": string;
|
|
93
|
-
"pact:matcher:type": string;
|
|
94
|
-
value: number;
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* Value must be a number
|
|
98
|
-
* @param num Example value. If omitted a random integer value will be generated.
|
|
99
|
-
*/
|
|
100
|
-
export declare function number(num?: number): {
|
|
101
|
-
"pact:matcher:type": string;
|
|
102
|
-
value: number;
|
|
103
|
-
"pact:generator:type"?: undefined;
|
|
104
|
-
} | {
|
|
105
|
-
"pact:generator:type": string;
|
|
106
|
-
"pact:matcher:type": string;
|
|
107
|
-
value: number;
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Value must be a string
|
|
111
|
-
* @param str Example value
|
|
112
|
-
*/
|
|
113
|
-
export declare function string(str: string): {
|
|
114
|
-
"pact:matcher:type": string;
|
|
115
|
-
value: string;
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Value that must match the given regular expression
|
|
119
|
-
* @param pattern Regular Expression to match
|
|
120
|
-
* @param str Example value
|
|
121
|
-
*/
|
|
122
|
-
export declare function regex(pattern: string, str: string): any;
|
|
123
|
-
/**
|
|
124
|
-
* Value that must match the given regular expression
|
|
125
|
-
* @param pattern Regular Expression to match
|
|
126
|
-
* @param str Example value
|
|
127
|
-
*/
|
|
128
|
-
export declare function regex(pattern: RegExp, str: string): any;
|
|
129
|
-
/**
|
|
130
|
-
* Value that must be equal to the example. This is mainly used to reset the matching rules which cascade.
|
|
131
|
-
* @param value Example value
|
|
132
|
-
*/
|
|
133
|
-
export declare function equal(value: any): {
|
|
134
|
-
"pact:matcher:type": string;
|
|
135
|
-
value: any;
|
|
136
|
-
};
|
|
137
|
-
/**
|
|
138
|
-
* String value that must match the provided datetime format string.
|
|
139
|
-
* @param format Datetime format string. See [Java SimpleDateFormat](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html)
|
|
140
|
-
* @param example Example value to use. If omitted a value using the current system date and time will be generated.
|
|
141
|
-
*/
|
|
142
|
-
export declare function timestamp(format: string, example?: string): {
|
|
143
|
-
"pact:generator:type": string;
|
|
144
|
-
"pact:matcher:type": string;
|
|
145
|
-
format: string;
|
|
146
|
-
timestamp: string;
|
|
147
|
-
value: any;
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* String value that must match the provided datetime format string.
|
|
151
|
-
* @param format Datetime format string. See [Java SimpleDateFormat](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html)
|
|
152
|
-
* @param example Example value to use. If omitted a value using the current system date and time will be generated.
|
|
153
|
-
*/
|
|
154
|
-
export declare function datetime(format: string, example?: string): {
|
|
155
|
-
"pact:generator:type": string;
|
|
156
|
-
"pact:matcher:type": string;
|
|
157
|
-
format: string;
|
|
158
|
-
timestamp: string;
|
|
159
|
-
value: any;
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* String value that must match the provided time format string.
|
|
163
|
-
* @param format Time format string. See [Java SimpleDateFormat](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html)
|
|
164
|
-
* @param example Example value to use. If omitted a value using the current system time will be generated.
|
|
165
|
-
*/
|
|
166
|
-
export declare function time(format: string, example?: string): {
|
|
167
|
-
"pact:generator:type": string;
|
|
168
|
-
"pact:matcher:type": string;
|
|
169
|
-
format: string;
|
|
170
|
-
time: string;
|
|
171
|
-
value: any;
|
|
172
|
-
};
|
|
173
|
-
/**
|
|
174
|
-
* String value that must match the provided date format string.
|
|
175
|
-
* @param format Date format string. See [Java SimpleDateFormat](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html)
|
|
176
|
-
* @param example Example value to use. If omitted a value using the current system date will be generated.
|
|
177
|
-
*/
|
|
178
|
-
export declare function date(format: any, example?: string): {
|
|
179
|
-
format: any;
|
|
180
|
-
"pact:generator:type": string;
|
|
181
|
-
"pact:matcher:type": string;
|
|
182
|
-
date: any;
|
|
183
|
-
value: any;
|
|
184
|
-
};
|
|
185
|
-
/**
|
|
186
|
-
* Value that must include the example value as a substring.
|
|
187
|
-
* @param value String value to include
|
|
188
|
-
*/
|
|
189
|
-
export declare function includes(value: string): {
|
|
190
|
-
"pact:matcher:type": string;
|
|
191
|
-
value: string;
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* Value that must be null. This will only match the JSON Null value. For other content types, it will
|
|
195
|
-
* match if the attribute is missing.
|
|
196
|
-
*/
|
|
197
|
-
export declare function nullValue(): {
|
|
198
|
-
"pact:matcher:type": string;
|
|
199
|
-
};
|
package/v3/matchers.js
DELETED
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var R = require("ramda");
|
|
4
|
-
var PactNative = require("../native");
|
|
5
|
-
/**
|
|
6
|
-
* Value must match the given template
|
|
7
|
-
* @param template Template to base the comparison on
|
|
8
|
-
*/
|
|
9
|
-
function like(template) {
|
|
10
|
-
return {
|
|
11
|
-
"pact:matcher:type": "type",
|
|
12
|
-
value: template,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
exports.like = like;
|
|
16
|
-
/**
|
|
17
|
-
* Array where each element must match the given template
|
|
18
|
-
* @param template Template to base the comparison on
|
|
19
|
-
*/
|
|
20
|
-
function eachLike(template) {
|
|
21
|
-
return {
|
|
22
|
-
"pact:matcher:type": "type",
|
|
23
|
-
value: [template],
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
exports.eachLike = eachLike;
|
|
27
|
-
/**
|
|
28
|
-
* An array that has to have at least one element and each element must match the given template
|
|
29
|
-
* @param template Template to base the comparison on
|
|
30
|
-
* @param count Number of examples to generate, defaults to one
|
|
31
|
-
*/
|
|
32
|
-
function atLeastOneLike(template, count) {
|
|
33
|
-
if (count === void 0) { count = 1; }
|
|
34
|
-
return {
|
|
35
|
-
min: 1,
|
|
36
|
-
"pact:matcher:type": "type",
|
|
37
|
-
value: R.times(function () { return template; }, count),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
exports.atLeastOneLike = atLeastOneLike;
|
|
41
|
-
/**
|
|
42
|
-
* An array that has to have at least the required number of elements and each element must match the given template
|
|
43
|
-
* @param template Template to base the comparison on
|
|
44
|
-
* @param min Minimum number of elements required in the array
|
|
45
|
-
* @param count Number of examples to generate, defaults to one
|
|
46
|
-
*/
|
|
47
|
-
function atLeastLike(template, min, count) {
|
|
48
|
-
var elements = count || min;
|
|
49
|
-
if (count && count < min) {
|
|
50
|
-
throw new Error("atLeastLike has a minimum of " +
|
|
51
|
-
min +
|
|
52
|
-
" but " +
|
|
53
|
-
count +
|
|
54
|
-
" elements where requested." +
|
|
55
|
-
" Make sure the count is greater than or equal to the min.");
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
min: min,
|
|
59
|
-
"pact:matcher:type": "type",
|
|
60
|
-
value: R.times(function () { return template; }, elements),
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
exports.atLeastLike = atLeastLike;
|
|
64
|
-
/**
|
|
65
|
-
* An array that has to have at most the required number of elements and each element must match the given template
|
|
66
|
-
* @param template Template to base the comparison on
|
|
67
|
-
* @param max Maximum number of elements required in the array
|
|
68
|
-
* @param count Number of examples to generate, defaults to one
|
|
69
|
-
*/
|
|
70
|
-
function atMostLike(template, max, count) {
|
|
71
|
-
var elements = count || 1;
|
|
72
|
-
if (count && count > max) {
|
|
73
|
-
throw new Error("atMostLike has a maximum of " +
|
|
74
|
-
max +
|
|
75
|
-
" but " +
|
|
76
|
-
count +
|
|
77
|
-
" elements where requested." +
|
|
78
|
-
" Make sure the count is less than or equal to the max.");
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
max: max,
|
|
82
|
-
"pact:matcher:type": "type",
|
|
83
|
-
value: R.times(function () { return template; }, elements),
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
exports.atMostLike = atMostLike;
|
|
87
|
-
/**
|
|
88
|
-
* An array whose size is constrained to the minimum and maximum number of elements and each element must match the given template
|
|
89
|
-
* @param template Template to base the comparison on
|
|
90
|
-
* @param min Minimum number of elements required in the array
|
|
91
|
-
* @param max Maximum number of elements required in the array
|
|
92
|
-
* @param count Number of examples to generate, defaults to one
|
|
93
|
-
*/
|
|
94
|
-
function constrainedArrayLike(template, min, max, count) {
|
|
95
|
-
var elements = count || min;
|
|
96
|
-
if (count) {
|
|
97
|
-
if (count < min) {
|
|
98
|
-
throw new Error("constrainedArrayLike has a minimum of " +
|
|
99
|
-
min +
|
|
100
|
-
" but " +
|
|
101
|
-
count +
|
|
102
|
-
" elements where requested." +
|
|
103
|
-
" Make sure the count is greater than or equal to the min.");
|
|
104
|
-
}
|
|
105
|
-
else if (count > max) {
|
|
106
|
-
throw new Error("constrainedArrayLike has a maximum of " +
|
|
107
|
-
max +
|
|
108
|
-
" but " +
|
|
109
|
-
count +
|
|
110
|
-
" elements where requested." +
|
|
111
|
-
" Make sure the count is less than or equal to the max.");
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
min: min,
|
|
116
|
-
max: max,
|
|
117
|
-
"pact:matcher:type": "type",
|
|
118
|
-
value: R.times(function () { return template; }, elements),
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
exports.constrainedArrayLike = constrainedArrayLike;
|
|
122
|
-
/**
|
|
123
|
-
* Value must be a boolean
|
|
124
|
-
* @param b Boolean example value
|
|
125
|
-
*/
|
|
126
|
-
function boolean(b) {
|
|
127
|
-
return {
|
|
128
|
-
"pact:matcher:type": "type",
|
|
129
|
-
value: b,
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
exports.boolean = boolean;
|
|
133
|
-
/**
|
|
134
|
-
* Value must be an integer (must be a number and have no decimal places)
|
|
135
|
-
* @param int Example value. If omitted a random value will be generated.
|
|
136
|
-
*/
|
|
137
|
-
function integer(int) {
|
|
138
|
-
if (int) {
|
|
139
|
-
return {
|
|
140
|
-
"pact:matcher:type": "integer",
|
|
141
|
-
value: int,
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
return {
|
|
146
|
-
"pact:generator:type": "RandomInt",
|
|
147
|
-
"pact:matcher:type": "integer",
|
|
148
|
-
value: 101,
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
exports.integer = integer;
|
|
153
|
-
/**
|
|
154
|
-
* Value must be a decimal number (must be a number and have decimal places)
|
|
155
|
-
* @param num Example value. If omitted a random value will be generated.
|
|
156
|
-
*/
|
|
157
|
-
function decimal(num) {
|
|
158
|
-
if (num) {
|
|
159
|
-
return {
|
|
160
|
-
"pact:matcher:type": "decimal",
|
|
161
|
-
value: num,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
return {
|
|
166
|
-
"pact:generator:type": "RandomDecimal",
|
|
167
|
-
"pact:matcher:type": "decimal",
|
|
168
|
-
value: 12.34,
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
exports.decimal = decimal;
|
|
173
|
-
/**
|
|
174
|
-
* Value must be a number
|
|
175
|
-
* @param num Example value. If omitted a random integer value will be generated.
|
|
176
|
-
*/
|
|
177
|
-
function number(num) {
|
|
178
|
-
if (num) {
|
|
179
|
-
return {
|
|
180
|
-
"pact:matcher:type": "number",
|
|
181
|
-
value: num,
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
return {
|
|
186
|
-
"pact:generator:type": "RandomInt",
|
|
187
|
-
"pact:matcher:type": "number",
|
|
188
|
-
value: 1234,
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
exports.number = number;
|
|
193
|
-
/**
|
|
194
|
-
* Value must be a string
|
|
195
|
-
* @param str Example value
|
|
196
|
-
*/
|
|
197
|
-
function string(str) {
|
|
198
|
-
return {
|
|
199
|
-
"pact:matcher:type": "type",
|
|
200
|
-
value: str,
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
exports.string = string;
|
|
204
|
-
function regex(pattern, str) {
|
|
205
|
-
if (pattern instanceof RegExp) {
|
|
206
|
-
return {
|
|
207
|
-
"pact:matcher:type": "regex",
|
|
208
|
-
regex: pattern.source,
|
|
209
|
-
value: str,
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
return {
|
|
213
|
-
"pact:matcher:type": "regex",
|
|
214
|
-
regex: pattern,
|
|
215
|
-
value: str,
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
exports.regex = regex;
|
|
219
|
-
/**
|
|
220
|
-
* Value that must be equal to the example. This is mainly used to reset the matching rules which cascade.
|
|
221
|
-
* @param value Example value
|
|
222
|
-
*/
|
|
223
|
-
function equal(value) {
|
|
224
|
-
return {
|
|
225
|
-
"pact:matcher:type": "equality",
|
|
226
|
-
value: value,
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
exports.equal = equal;
|
|
230
|
-
/**
|
|
231
|
-
* String value that must match the provided datetime format string.
|
|
232
|
-
* @param format Datetime format string. See [Java SimpleDateFormat](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html)
|
|
233
|
-
* @param example Example value to use. If omitted a value using the current system date and time will be generated.
|
|
234
|
-
*/
|
|
235
|
-
function timestamp(format, example) {
|
|
236
|
-
return datetime(format, example);
|
|
237
|
-
}
|
|
238
|
-
exports.timestamp = timestamp;
|
|
239
|
-
/**
|
|
240
|
-
* String value that must match the provided datetime format string.
|
|
241
|
-
* @param format Datetime format string. See [Java SimpleDateFormat](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html)
|
|
242
|
-
* @param example Example value to use. If omitted a value using the current system date and time will be generated.
|
|
243
|
-
*/
|
|
244
|
-
function datetime(format, example) {
|
|
245
|
-
return {
|
|
246
|
-
"pact:generator:type": "DateTime",
|
|
247
|
-
"pact:matcher:type": "timestamp",
|
|
248
|
-
format: format,
|
|
249
|
-
timestamp: format,
|
|
250
|
-
value: example || PactNative.generate_datetime_string(format),
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
exports.datetime = datetime;
|
|
254
|
-
/**
|
|
255
|
-
* String value that must match the provided time format string.
|
|
256
|
-
* @param format Time format string. See [Java SimpleDateFormat](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html)
|
|
257
|
-
* @param example Example value to use. If omitted a value using the current system time will be generated.
|
|
258
|
-
*/
|
|
259
|
-
function time(format, example) {
|
|
260
|
-
return {
|
|
261
|
-
"pact:generator:type": "Time",
|
|
262
|
-
"pact:matcher:type": "time",
|
|
263
|
-
format: format,
|
|
264
|
-
time: format,
|
|
265
|
-
value: example || PactNative.generate_datetime_string(format),
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
exports.time = time;
|
|
269
|
-
/**
|
|
270
|
-
* String value that must match the provided date format string.
|
|
271
|
-
* @param format Date format string. See [Java SimpleDateFormat](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html)
|
|
272
|
-
* @param example Example value to use. If omitted a value using the current system date will be generated.
|
|
273
|
-
*/
|
|
274
|
-
function date(format, example) {
|
|
275
|
-
return {
|
|
276
|
-
format: format,
|
|
277
|
-
"pact:generator:type": "Date",
|
|
278
|
-
"pact:matcher:type": "date",
|
|
279
|
-
date: format,
|
|
280
|
-
value: example || PactNative.generate_datetime_string(format),
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
exports.date = date;
|
|
284
|
-
/**
|
|
285
|
-
* Value that must include the example value as a substring.
|
|
286
|
-
* @param value String value to include
|
|
287
|
-
*/
|
|
288
|
-
function includes(value) {
|
|
289
|
-
return {
|
|
290
|
-
"pact:matcher:type": "include",
|
|
291
|
-
value: value,
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
exports.includes = includes;
|
|
295
|
-
/**
|
|
296
|
-
* Value that must be null. This will only match the JSON Null value. For other content types, it will
|
|
297
|
-
* match if the attribute is missing.
|
|
298
|
-
*/
|
|
299
|
-
function nullValue() {
|
|
300
|
-
return {
|
|
301
|
-
"pact:matcher:type": "null",
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
exports.nullValue = nullValue;
|
|
305
|
-
//# sourceMappingURL=matchers.js.map
|
package/v3/matchers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"matchers.js","sourceRoot":"","sources":["../../src/v3/matchers.ts"],"names":[],"mappings":";;AAAA,yBAA0B;AAC1B,IAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;AAEvC;;;GAGG;AACH,SAAgB,IAAI,CAA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v3/pact.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export interface PactV3Options {
|
|
2
|
-
dir: string;
|
|
3
|
-
consumer: string;
|
|
4
|
-
provider: string;
|
|
5
|
-
}
|
|
6
|
-
export interface V3ProviderState {
|
|
7
|
-
description: string;
|
|
8
|
-
parameters?: any;
|
|
9
|
-
}
|
|
10
|
-
export interface V3Request {
|
|
11
|
-
method: string;
|
|
12
|
-
path: string;
|
|
13
|
-
query?: {
|
|
14
|
-
[param: string]: string;
|
|
15
|
-
};
|
|
16
|
-
headers?: {
|
|
17
|
-
[header: string]: string;
|
|
18
|
-
};
|
|
19
|
-
body?: any;
|
|
20
|
-
}
|
|
21
|
-
export interface V3Response {
|
|
22
|
-
status: number;
|
|
23
|
-
headers?: {
|
|
24
|
-
[header: string]: string;
|
|
25
|
-
};
|
|
26
|
-
body?: any;
|
|
27
|
-
}
|
|
28
|
-
export interface V3MockServer {
|
|
29
|
-
port: number;
|
|
30
|
-
url: string;
|
|
31
|
-
id: string;
|
|
32
|
-
}
|
|
33
|
-
export declare class PactV3 {
|
|
34
|
-
private opts;
|
|
35
|
-
private states;
|
|
36
|
-
private pact;
|
|
37
|
-
constructor(opts: PactV3Options & {});
|
|
38
|
-
given(providerState: string, parameters?: any): this;
|
|
39
|
-
uponReceiving(desc: string): this;
|
|
40
|
-
withRequest(req: V3Request): this;
|
|
41
|
-
withRequestBinaryFile(req: V3Request, contentType: string, file: string): this;
|
|
42
|
-
withRequestMultipartFileUpload(req: V3Request, contentType: string, file: string, part: string): this;
|
|
43
|
-
willRespondWith(res: V3Response): this;
|
|
44
|
-
withResponseBinaryFile(res: V3Response, contentType: string, file: string): this;
|
|
45
|
-
withResponseMultipartFileUpload(req: V3Response, contentType: string, file: string, part: string): this;
|
|
46
|
-
executeTest<T>(testFn: (mockServer: V3MockServer) => Promise<T>): Promise<T>;
|
|
47
|
-
}
|
package/v3/pact.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var PactNative = require("../native");
|
|
4
|
-
var PactV3 = /** @class */ (function () {
|
|
5
|
-
function PactV3(opts) {
|
|
6
|
-
this.states = [];
|
|
7
|
-
this.opts = opts;
|
|
8
|
-
this.pact = new PactNative.Pact(opts.consumer, opts.provider);
|
|
9
|
-
}
|
|
10
|
-
PactV3.prototype.given = function (providerState, parameters) {
|
|
11
|
-
this.states.push({ description: providerState, parameters: parameters });
|
|
12
|
-
return this;
|
|
13
|
-
};
|
|
14
|
-
PactV3.prototype.uponReceiving = function (desc) {
|
|
15
|
-
this.pact.addInteraction(desc, this.states);
|
|
16
|
-
return this;
|
|
17
|
-
};
|
|
18
|
-
PactV3.prototype.withRequest = function (req) {
|
|
19
|
-
this.pact.addRequest(req, req.body && JSON.stringify(req.body));
|
|
20
|
-
return this;
|
|
21
|
-
};
|
|
22
|
-
PactV3.prototype.withRequestBinaryFile = function (req, contentType, file) {
|
|
23
|
-
this.pact.addRequestBinaryFile(req, contentType, file);
|
|
24
|
-
return this;
|
|
25
|
-
};
|
|
26
|
-
PactV3.prototype.withRequestMultipartFileUpload = function (req, contentType, file, part) {
|
|
27
|
-
this.pact.addRequestMultipartFileUpload(req, contentType, file, part);
|
|
28
|
-
return this;
|
|
29
|
-
};
|
|
30
|
-
PactV3.prototype.willRespondWith = function (res) {
|
|
31
|
-
this.pact.addResponse(res, res.body && JSON.stringify(res.body));
|
|
32
|
-
this.states = [];
|
|
33
|
-
return this;
|
|
34
|
-
};
|
|
35
|
-
PactV3.prototype.withResponseBinaryFile = function (res, contentType, file) {
|
|
36
|
-
this.pact.addResponseBinaryFile(res, contentType, file);
|
|
37
|
-
return this;
|
|
38
|
-
};
|
|
39
|
-
PactV3.prototype.withResponseMultipartFileUpload = function (req, contentType, file, part) {
|
|
40
|
-
this.pact.addResponseMultipartFileUpload(req, contentType, file, part);
|
|
41
|
-
return this;
|
|
42
|
-
};
|
|
43
|
-
PactV3.prototype.executeTest = function (testFn) {
|
|
44
|
-
var _this = this;
|
|
45
|
-
var result = this.pact.executeTest(testFn);
|
|
46
|
-
if (result.testResult) {
|
|
47
|
-
return result.testResult
|
|
48
|
-
.then(function (val) {
|
|
49
|
-
var testResult = _this.pact.getTestResult(result.mockServer.id);
|
|
50
|
-
if (testResult.mockServerError) {
|
|
51
|
-
return Promise.reject(new Error(testResult.mockServerError));
|
|
52
|
-
}
|
|
53
|
-
else if (testResult.mockServerMismatches) {
|
|
54
|
-
var error = "Mock server failed with the following mismatches: ";
|
|
55
|
-
for (var _i = 0, _a = testResult.mockServerMismatches; _i < _a.length; _i++) {
|
|
56
|
-
var mismatch = _a[_i];
|
|
57
|
-
error += "\n\t" + mismatch;
|
|
58
|
-
}
|
|
59
|
-
return Promise.reject(new Error(error));
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
_this.pact.writePactFile(result.mockServer.id, _this.opts.dir);
|
|
63
|
-
return val;
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
.catch(function (err) {
|
|
67
|
-
var testResult = _this.pact.getTestResult(result.mockServer.id);
|
|
68
|
-
var error = "Test failed for the following reasons:";
|
|
69
|
-
error += "\n\n\tTest code failed with an error: " + err.message;
|
|
70
|
-
if (testResult.mockServerError) {
|
|
71
|
-
error += "\n\n\t" + testResult.mockServerError;
|
|
72
|
-
}
|
|
73
|
-
if (testResult.mockServerMismatches) {
|
|
74
|
-
error += "\n\n\tMock server failed with the following mismatches: ";
|
|
75
|
-
var i = 1;
|
|
76
|
-
for (var _i = 0, _a = testResult.mockServerMismatches; _i < _a.length; _i++) {
|
|
77
|
-
var mismatchJson = _a[_i];
|
|
78
|
-
var mismatches = JSON.parse(mismatchJson);
|
|
79
|
-
if (mismatches.mismatches) {
|
|
80
|
-
for (var _b = 0, _c = mismatches.mismatches; _b < _c.length; _b++) {
|
|
81
|
-
var mismatch = _c[_b];
|
|
82
|
-
error += "\n\t\t" + i++ + ") " + mismatch.type + " " + (mismatch.path ? "(at " + mismatch.path + ") " : "") + mismatch.mismatch;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return Promise.reject(new Error(error));
|
|
88
|
-
})
|
|
89
|
-
.finally(function () {
|
|
90
|
-
_this.pact.shutdownTest(result);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
this.pact.shutdownTest(result);
|
|
95
|
-
return Promise.reject(result.testError);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
return PactV3;
|
|
99
|
-
}());
|
|
100
|
-
exports.PactV3 = PactV3;
|
|
101
|
-
//# sourceMappingURL=pact.js.map
|
package/v3/pact.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pact.js","sourceRoot":"","sources":["../../src/v3/pact.ts"],"names":[],"mappings":";;AACA,IAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;AAuCvC;IAKE,gBAAY,IAAwB;QAH5B,WAAM,GAAsB,EAAE,CAAA;QAIpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC/D,CAAC;IAEM,sBAAK,GAAZ,UAAa,aAAqB,EAAE,UAAgB;QAClD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,YAAA,EAAE,CAAC,CAAA;QAC5D,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,8BAAa,GAApB,UAAqB,IAAY;QAC/B,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QAC3C,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,4BAAW,GAAlB,UAAmB,GAAc;Q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