@http-forge/core 0.6.21 → 0.6.22
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/dist/index.d.ts +1 -0
- package/dist/index.js +232 -230
- package/dist/index.mjs +238 -236
- package/dist/infrastructure/script/expect-chain.d.ts +120 -0
- package/dist/infrastructure/script/json-schema-validator.d.ts +9 -0
- package/dist/infrastructure/script/script-executor.d.ts +3 -0
- package/dist/infrastructure/script/script-factories.d.ts +10 -90
- package/dist/infrastructure/test-suite/html-report-generator.d.ts +2 -2
- package/dist/infrastructure/test-suite/result-storage.d.ts +8 -0
- package/dist/infrastructure/test-suite/test-suite-store.d.ts +4 -0
- package/dist/runtime/result-grouping.d.ts +17 -0
- package/dist/types/types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chai/Postman-compatible expect chain.
|
|
3
|
+
*
|
|
4
|
+
* Implements the full Chai BDD expect surface plus Postman-specific
|
|
5
|
+
* extensions (`jsonSchema`). Organized by category for easy navigation.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Chai-style expect chain with Postman-compatible extensions.
|
|
9
|
+
* Mirrors the full Chai BDD `expect(...)` surface.
|
|
10
|
+
*/
|
|
11
|
+
export interface ExpectChain {
|
|
12
|
+
_value: any;
|
|
13
|
+
_negated: boolean;
|
|
14
|
+
_deep: boolean;
|
|
15
|
+
to: ExpectChain;
|
|
16
|
+
be: ExpectChain;
|
|
17
|
+
been: ExpectChain;
|
|
18
|
+
is: ExpectChain;
|
|
19
|
+
that: ExpectChain;
|
|
20
|
+
which: ExpectChain;
|
|
21
|
+
and: ExpectChain;
|
|
22
|
+
has: ExpectChain;
|
|
23
|
+
have: ExpectChain;
|
|
24
|
+
with: ExpectChain;
|
|
25
|
+
at: ExpectChain;
|
|
26
|
+
of: ExpectChain;
|
|
27
|
+
same: ExpectChain;
|
|
28
|
+
but: ExpectChain;
|
|
29
|
+
does: ExpectChain;
|
|
30
|
+
still: ExpectChain;
|
|
31
|
+
also: ExpectChain;
|
|
32
|
+
/** Negates the next assertion. */
|
|
33
|
+
not: ExpectChain;
|
|
34
|
+
/** Use deep (structural) equality in equal/include/members/keys/property. */
|
|
35
|
+
deep: ExpectChain;
|
|
36
|
+
/** Enable dot- and bracket-notation path resolution in property/include. */
|
|
37
|
+
nested: ExpectChain;
|
|
38
|
+
/** Restrict property/include to own (non-inherited) properties. */
|
|
39
|
+
own: ExpectChain;
|
|
40
|
+
/** Require members to appear in order. */
|
|
41
|
+
ordered: ExpectChain;
|
|
42
|
+
/** Require *any* of the given keys to be present (use with keys). */
|
|
43
|
+
any: ExpectChain;
|
|
44
|
+
/** Require *all* of the given keys to be present (default; use with keys). */
|
|
45
|
+
all: ExpectChain;
|
|
46
|
+
/** When asserting on a function, target the function itself rather than its prototype. */
|
|
47
|
+
itself: ExpectChain;
|
|
48
|
+
ok: ExpectChain;
|
|
49
|
+
"true": ExpectChain;
|
|
50
|
+
"false": ExpectChain;
|
|
51
|
+
"null": ExpectChain;
|
|
52
|
+
"undefined": ExpectChain;
|
|
53
|
+
"NaN": ExpectChain;
|
|
54
|
+
exist: ExpectChain;
|
|
55
|
+
exists: ExpectChain;
|
|
56
|
+
empty: ExpectChain;
|
|
57
|
+
"arguments": ExpectChain;
|
|
58
|
+
"Arguments": ExpectChain;
|
|
59
|
+
extensible: ExpectChain;
|
|
60
|
+
sealed: ExpectChain;
|
|
61
|
+
frozen: ExpectChain;
|
|
62
|
+
finite: ExpectChain;
|
|
63
|
+
equal(expected: any): ExpectChain;
|
|
64
|
+
eq(expected: any): ExpectChain;
|
|
65
|
+
equals(expected: any): ExpectChain;
|
|
66
|
+
eql(expected: any): ExpectChain;
|
|
67
|
+
eqls(expected: any): ExpectChain;
|
|
68
|
+
include(value: any): ExpectChain;
|
|
69
|
+
includes(value: any): ExpectChain;
|
|
70
|
+
contain(value: any): ExpectChain;
|
|
71
|
+
contains(value: any): ExpectChain;
|
|
72
|
+
oneOf(values: any[]): ExpectChain;
|
|
73
|
+
property(name: string, value?: any): ExpectChain;
|
|
74
|
+
ownPropertyDescriptor(name: string, descriptor?: PropertyDescriptor): ExpectChain;
|
|
75
|
+
haveOwnPropertyDescriptor(name: string, descriptor?: PropertyDescriptor): ExpectChain;
|
|
76
|
+
keys(...args: any[]): ExpectChain;
|
|
77
|
+
key(...args: any[]): ExpectChain;
|
|
78
|
+
members(arr: any[]): ExpectChain;
|
|
79
|
+
string(substr: string): ExpectChain;
|
|
80
|
+
match(pattern: RegExp): ExpectChain;
|
|
81
|
+
matches(pattern: RegExp): ExpectChain;
|
|
82
|
+
a(type: string): ExpectChain;
|
|
83
|
+
an(type: string): ExpectChain;
|
|
84
|
+
length(len: number): ExpectChain;
|
|
85
|
+
lengthOf(len: number): ExpectChain;
|
|
86
|
+
satisfy(matcher: (value: any) => any): ExpectChain;
|
|
87
|
+
satisfies(matcher: (value: any) => any): ExpectChain;
|
|
88
|
+
jsonSchema(schema: any): ExpectChain;
|
|
89
|
+
above(num: number): ExpectChain;
|
|
90
|
+
gt(num: number): ExpectChain;
|
|
91
|
+
greaterThan(num: number): ExpectChain;
|
|
92
|
+
least(num: number): ExpectChain;
|
|
93
|
+
gte(num: number): ExpectChain;
|
|
94
|
+
greaterThanOrEqual(num: number): ExpectChain;
|
|
95
|
+
below(num: number): ExpectChain;
|
|
96
|
+
lt(num: number): ExpectChain;
|
|
97
|
+
lessThan(num: number): ExpectChain;
|
|
98
|
+
most(num: number): ExpectChain;
|
|
99
|
+
lte(num: number): ExpectChain;
|
|
100
|
+
lessThanOrEqual(num: number): ExpectChain;
|
|
101
|
+
within(start: number, end: number): ExpectChain;
|
|
102
|
+
closeTo(expected: number, delta: number): ExpectChain;
|
|
103
|
+
approximately(expected: number, delta: number): ExpectChain;
|
|
104
|
+
instanceOf(constructor: Function): ExpectChain;
|
|
105
|
+
"instanceof"(constructor: Function): ExpectChain;
|
|
106
|
+
"throw"(expected?: any): ExpectChain;
|
|
107
|
+
throws(expected?: any): ExpectChain;
|
|
108
|
+
"Throw"(expected?: any): ExpectChain;
|
|
109
|
+
respondTo(method: string): ExpectChain;
|
|
110
|
+
respondsTo(method: string): ExpectChain;
|
|
111
|
+
change(subject: any, prop?: string): ExpectChain;
|
|
112
|
+
changes(subject: any, prop?: string): ExpectChain;
|
|
113
|
+
increase(subject: any, prop?: string): ExpectChain;
|
|
114
|
+
increases(subject: any, prop?: string): ExpectChain;
|
|
115
|
+
decrease(subject: any, prop?: string): ExpectChain;
|
|
116
|
+
decreases(subject: any, prop?: string): ExpectChain;
|
|
117
|
+
/** Assert the magnitude of the preceding change/increase/decrease. */
|
|
118
|
+
by(delta: number): ExpectChain;
|
|
119
|
+
}
|
|
120
|
+
export declare function createExpectChain(value: any): ExpectChain;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal, dependency-free JSON Schema validator.
|
|
3
|
+
*
|
|
4
|
+
* Supports the common subset used in API tests (draft-04 style):
|
|
5
|
+
* `type`, `properties`, `required`, `items`, `enum`, `additionalProperties`
|
|
6
|
+
* (boolean), `minimum`/`maximum`, `minLength`/`maxLength`, and `pattern`.
|
|
7
|
+
* Returns a list of human-readable error strings (empty when valid).
|
|
8
|
+
*/
|
|
9
|
+
export declare function validateJsonSchema(data: any, schema: any, path?: string): string[];
|
|
@@ -49,6 +49,9 @@ export declare class ScriptExecutor implements IScriptExecutor {
|
|
|
49
49
|
private static readonly JSON_TYPE_MARKER;
|
|
50
50
|
/**
|
|
51
51
|
* Serialize a value for storage. Non-string values are JSON-stringified with a type marker.
|
|
52
|
+
* `undefined` is stored explicitly (JSON.stringify(undefined) yields JS undefined, which would
|
|
53
|
+
* corrupt the marker into the literal "undefined"). It round-trips back to undefined and renders
|
|
54
|
+
* empty, matching Postman (a variable set to undefined resolves to an empty string).
|
|
52
55
|
*/
|
|
53
56
|
private serializeValue;
|
|
54
57
|
/**
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Script Factories
|
|
3
3
|
*
|
|
4
|
-
* Single Responsibility: Create objects used in script execution contexts
|
|
5
|
-
*
|
|
4
|
+
* Single Responsibility: Create objects used in script execution contexts.
|
|
5
|
+
*
|
|
6
|
+
* `validateJsonSchema` lives in ./json-schema-validator
|
|
7
|
+
* `ExpectChain` / `createExpectChain` live in ./expect-chain
|
|
8
|
+
* Both are re-exported here for backward compatibility.
|
|
6
9
|
*/
|
|
7
10
|
import { Cookie } from '../cookie/interfaces';
|
|
8
11
|
import { ResponseContext } from './interfaces';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* Supports the common subset used in API tests (draft-04 style):
|
|
13
|
-
* `type`, `properties`, `required`, `items`, `enum`, `additionalProperties`
|
|
14
|
-
* (boolean), `minimum`/`maximum`, `minLength`/`maxLength`, and `pattern`.
|
|
15
|
-
* Returns a list of human-readable error strings (empty when valid).
|
|
16
|
-
*/
|
|
17
|
-
export declare function validateJsonSchema(data: any, schema: any, path?: string): string[];
|
|
12
|
+
export { createExpectChain } from './expect-chain';
|
|
13
|
+
export type { ExpectChain } from './expect-chain';
|
|
14
|
+
export { validateJsonSchema } from './json-schema-validator';
|
|
18
15
|
/**
|
|
19
16
|
* Response object interface for script context
|
|
20
17
|
*/
|
|
@@ -102,86 +99,9 @@ export interface CookieList extends Array<PostmanCookie> {
|
|
|
102
99
|
count(): number;
|
|
103
100
|
idx(index: number): PostmanCookie | undefined;
|
|
104
101
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Create a Postman-compatible CookieList from parsed cookies.
|
|
107
|
-
*/
|
|
108
102
|
export declare function createCookieList(cookies: Cookie[]): CookieList;
|
|
109
103
|
/**
|
|
110
|
-
* Create response object with helper methods for script context
|
|
111
|
-
* Provides Postman-compatible response API
|
|
104
|
+
* Create response object with helper methods for script context.
|
|
105
|
+
* Provides Postman-compatible response API.
|
|
112
106
|
*/
|
|
113
107
|
export declare function createResponseObject(response: ResponseContext): ScriptResponse;
|
|
114
|
-
/**
|
|
115
|
-
* Expect chain interface for Chai-style assertions
|
|
116
|
-
*/
|
|
117
|
-
export interface ExpectChain {
|
|
118
|
-
_value: any;
|
|
119
|
-
_negated: boolean;
|
|
120
|
-
_deep: boolean;
|
|
121
|
-
not: ExpectChain;
|
|
122
|
-
to: ExpectChain;
|
|
123
|
-
be: ExpectChain;
|
|
124
|
-
have: ExpectChain;
|
|
125
|
-
deep: ExpectChain;
|
|
126
|
-
and: ExpectChain;
|
|
127
|
-
that: ExpectChain;
|
|
128
|
-
which: ExpectChain;
|
|
129
|
-
is: ExpectChain;
|
|
130
|
-
been: ExpectChain;
|
|
131
|
-
has: ExpectChain;
|
|
132
|
-
with: ExpectChain;
|
|
133
|
-
at: ExpectChain;
|
|
134
|
-
of: ExpectChain;
|
|
135
|
-
same: ExpectChain;
|
|
136
|
-
but: ExpectChain;
|
|
137
|
-
does: ExpectChain;
|
|
138
|
-
still: ExpectChain;
|
|
139
|
-
also: ExpectChain;
|
|
140
|
-
equal(expected: any): ExpectChain;
|
|
141
|
-
eq(expected: any): ExpectChain;
|
|
142
|
-
equals(expected: any): ExpectChain;
|
|
143
|
-
eql(expected: any): ExpectChain;
|
|
144
|
-
eqls(expected: any): ExpectChain;
|
|
145
|
-
property(name: string, value?: any): ExpectChain;
|
|
146
|
-
ok: ExpectChain;
|
|
147
|
-
exist: ExpectChain;
|
|
148
|
-
include(value: any): ExpectChain;
|
|
149
|
-
includes(value: any): ExpectChain;
|
|
150
|
-
contain(value: any): ExpectChain;
|
|
151
|
-
contains(value: any): ExpectChain;
|
|
152
|
-
oneOf(values: any[]): ExpectChain;
|
|
153
|
-
match(pattern: RegExp): ExpectChain;
|
|
154
|
-
above(num: number): ExpectChain;
|
|
155
|
-
below(num: number): ExpectChain;
|
|
156
|
-
gt(num: number): ExpectChain;
|
|
157
|
-
lt(num: number): ExpectChain;
|
|
158
|
-
least(num: number): ExpectChain;
|
|
159
|
-
most(num: number): ExpectChain;
|
|
160
|
-
gte(num: number): ExpectChain;
|
|
161
|
-
lte(num: number): ExpectChain;
|
|
162
|
-
greaterThan(num: number): ExpectChain;
|
|
163
|
-
lessThan(num: number): ExpectChain;
|
|
164
|
-
closeTo(expected: number, delta: number): ExpectChain;
|
|
165
|
-
approximately(expected: number, delta: number): ExpectChain;
|
|
166
|
-
within(start: number, end: number): ExpectChain;
|
|
167
|
-
a(type: string): ExpectChain;
|
|
168
|
-
an(type: string): ExpectChain;
|
|
169
|
-
"throw"(expected?: any): ExpectChain;
|
|
170
|
-
throws(expected?: any): ExpectChain;
|
|
171
|
-
instanceOf(constructor: Function): ExpectChain;
|
|
172
|
-
"instanceof"(constructor: Function): ExpectChain;
|
|
173
|
-
true: ExpectChain;
|
|
174
|
-
false: ExpectChain;
|
|
175
|
-
null: ExpectChain;
|
|
176
|
-
undefined: ExpectChain;
|
|
177
|
-
empty: ExpectChain;
|
|
178
|
-
length(len: number): ExpectChain;
|
|
179
|
-
lengthOf(len: number): ExpectChain;
|
|
180
|
-
members(arr: any[]): ExpectChain;
|
|
181
|
-
keys(...args: any[]): ExpectChain;
|
|
182
|
-
string(substr: string): ExpectChain;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Create Chai-style expect chain for assertions
|
|
186
|
-
*/
|
|
187
|
-
export declare function createExpectChain(value: any): ExpectChain;
|
|
@@ -25,8 +25,8 @@ export declare class HtmlReportGenerator {
|
|
|
25
25
|
/** Load every result file for every request (pass + fail). */
|
|
26
26
|
private loadAllDetails;
|
|
27
27
|
/**
|
|
28
|
-
* Group summaries by iteration, then by (collection +
|
|
29
|
-
* preserving execution order
|
|
28
|
+
* Group summaries by iteration, then by contiguous (collection + group path)
|
|
29
|
+
* segments while preserving exact execution order.
|
|
30
30
|
*/
|
|
31
31
|
private groupByIterCollectionFolder;
|
|
32
32
|
/**
|
|
@@ -41,6 +41,10 @@ export interface ResultSummary {
|
|
|
41
41
|
e: string | null;
|
|
42
42
|
/** Folder path (fp) - slash-separated; omitted/empty for root-level requests */
|
|
43
43
|
fp?: string;
|
|
44
|
+
/** Display group path (gp) - block label or folder path used for grouped results */
|
|
45
|
+
gp?: string;
|
|
46
|
+
/** Display grouping source (gt) - block label vs root-folder grouping */
|
|
47
|
+
gt?: 'folder' | 'block';
|
|
44
48
|
/** Collection name (cn) - omitted/empty when unknown */
|
|
45
49
|
cn?: string;
|
|
46
50
|
}
|
|
@@ -181,6 +185,10 @@ export interface FullResultDetails {
|
|
|
181
185
|
url: string;
|
|
182
186
|
/** Folder path within the collection (slash-separated; empty for root) */
|
|
183
187
|
folderPath?: string;
|
|
188
|
+
/** Display group path used by suite results (block label or folder path) */
|
|
189
|
+
groupPath?: string;
|
|
190
|
+
/** Display grouping source used by suite results */
|
|
191
|
+
groupType?: 'folder' | 'block';
|
|
184
192
|
/** Name of the collection this request belongs to */
|
|
185
193
|
collectionName?: string;
|
|
186
194
|
/** HTTP status code */
|
|
@@ -26,6 +26,10 @@ export interface SuiteRequestEntry {
|
|
|
26
26
|
folderScriptsChain: RequestScripts[];
|
|
27
27
|
/** Folder auth chain */
|
|
28
28
|
folderAuthChain: RequestAuth[];
|
|
29
|
+
/** Folder path resolved from source collection traversal */
|
|
30
|
+
resolvedFolderPath?: string;
|
|
31
|
+
/** Collection name resolved from the source collection */
|
|
32
|
+
resolvedCollectionName?: string;
|
|
29
33
|
}
|
|
30
34
|
/**
|
|
31
35
|
* Interface for TestSuiteStore
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type ResultGroupType = 'folder' | 'block';
|
|
2
|
+
export interface ResultGroupingInput {
|
|
3
|
+
collectionName?: string;
|
|
4
|
+
folderPath?: string;
|
|
5
|
+
blockLabel?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ResultGrouping {
|
|
8
|
+
groupPath: string;
|
|
9
|
+
groupType?: ResultGroupType;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Normalize how grouped results are labeled across extension, CLI, and MCP.
|
|
13
|
+
*
|
|
14
|
+
* Block labels always win. Otherwise, the group path is collection name plus
|
|
15
|
+
* folder path so the same folder name in different collections never merges.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveResultGrouping(input: ResultGroupingInput): ResultGrouping;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -687,6 +687,10 @@ export interface ExecutionResult {
|
|
|
687
687
|
error?: string;
|
|
688
688
|
/** Folder path of the request within its collection (slash-separated; empty for root) */
|
|
689
689
|
folderPath?: string;
|
|
690
|
+
/** Display grouping path used by suite results (block label or folder path) */
|
|
691
|
+
groupPath?: string;
|
|
692
|
+
/** Display grouping source used by suite results */
|
|
693
|
+
groupType?: 'folder' | 'block';
|
|
690
694
|
/** Name of the collection this request belongs to (for multi-collection suite reports) */
|
|
691
695
|
collectionName?: string;
|
|
692
696
|
/** Postman-compatible: pm.execution.setNextRequest() value. null = stop runner. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@http-forge/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.22",
|
|
4
4
|
"description": "Headless Postman-compatible API testing engine for Node.js, CI/CD, OpenAPI workflows, and HTTP Forge automation",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|