@memberjunction/testing-engine 2.128.0 → 2.130.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/dist/drivers/AgentEvalDriver.d.ts +38 -10
- package/dist/drivers/AgentEvalDriver.d.ts.map +1 -1
- package/dist/drivers/AgentEvalDriver.js +209 -87
- package/dist/drivers/AgentEvalDriver.js.map +1 -1
- package/dist/drivers/BaseTestDriver.d.ts +52 -1
- package/dist/drivers/BaseTestDriver.d.ts.map +1 -1
- package/dist/drivers/BaseTestDriver.js +78 -1
- package/dist/drivers/BaseTestDriver.js.map +1 -1
- package/dist/engine/TestEngine.d.ts +17 -3
- package/dist/engine/TestEngine.d.ts.map +1 -1
- package/dist/engine/TestEngine.js +149 -17
- package/dist/engine/TestEngine.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +15 -312
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/execution-context.d.ts +23 -0
- package/dist/utils/execution-context.d.ts.map +1 -0
- package/dist/utils/execution-context.js +177 -0
- package/dist/utils/execution-context.js.map +1 -0
- package/package.json +10 -10
package/dist/types.d.ts
CHANGED
|
@@ -1,220 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Core type definitions for the Testing Engine
|
|
3
|
+
*
|
|
4
|
+
* Note: UI-safe types are defined in @memberjunction/testing-engine-base
|
|
5
|
+
* This file contains execution-specific types that depend on engine internals
|
|
3
6
|
*/
|
|
4
7
|
import { UserInfo } from '@memberjunction/core';
|
|
5
8
|
import { TestEntity, TestRunEntity, AIAgentRunEntity } from '@memberjunction/core-entities';
|
|
6
9
|
import { IOracle } from './oracles/IOracle';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
export interface TestProgress {
|
|
11
|
-
/**
|
|
12
|
-
* Current execution step
|
|
13
|
-
*/
|
|
14
|
-
step: string;
|
|
15
|
-
/**
|
|
16
|
-
* Progress percentage (0-100)
|
|
17
|
-
*/
|
|
18
|
-
percentage: number;
|
|
19
|
-
/**
|
|
20
|
-
* Human-readable message
|
|
21
|
-
*/
|
|
22
|
-
message: string;
|
|
23
|
-
/**
|
|
24
|
-
* Additional metadata
|
|
25
|
-
*/
|
|
26
|
-
metadata?: {
|
|
27
|
-
testName?: string;
|
|
28
|
-
testRun?: any;
|
|
29
|
-
driverType?: string;
|
|
30
|
-
oracleType?: string;
|
|
31
|
-
[key: string]: any;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Options for running a single test
|
|
36
|
-
*/
|
|
37
|
-
export interface TestRunOptions {
|
|
38
|
-
/**
|
|
39
|
-
* Verbose logging
|
|
40
|
-
*/
|
|
41
|
-
verbose?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Validate configuration without executing
|
|
44
|
-
*/
|
|
45
|
-
dryRun?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Environment context (dev, staging, prod)
|
|
48
|
-
*/
|
|
49
|
-
environment?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Git commit SHA for versioning
|
|
52
|
-
*/
|
|
53
|
-
gitCommit?: string;
|
|
54
|
-
/**
|
|
55
|
-
* Agent/system version being tested
|
|
56
|
-
*/
|
|
57
|
-
agentVersion?: string;
|
|
58
|
-
/**
|
|
59
|
-
* Override test configuration
|
|
60
|
-
*/
|
|
61
|
-
configOverride?: Record<string, unknown>;
|
|
62
|
-
/**
|
|
63
|
-
* Progress callback for real-time updates
|
|
64
|
-
*/
|
|
65
|
-
progressCallback?: (progress: TestProgress) => void;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Options for running a test suite
|
|
69
|
-
*/
|
|
70
|
-
export interface SuiteRunOptions extends TestRunOptions {
|
|
71
|
-
/**
|
|
72
|
-
* Run tests in parallel
|
|
73
|
-
*/
|
|
74
|
-
parallel?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Stop on first failure
|
|
77
|
-
*/
|
|
78
|
-
failFast?: boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Maximum parallel tests (if parallel=true)
|
|
81
|
-
*/
|
|
82
|
-
maxParallel?: number;
|
|
83
|
-
/**
|
|
84
|
-
* Run only specific sequence numbers
|
|
85
|
-
*/
|
|
86
|
-
sequence?: number[];
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Result from running a single test
|
|
90
|
-
*/
|
|
91
|
-
export interface TestRunResult {
|
|
92
|
-
/**
|
|
93
|
-
* Test Run ID
|
|
94
|
-
*/
|
|
95
|
-
testRunId: string;
|
|
96
|
-
/**
|
|
97
|
-
* Test ID
|
|
98
|
-
*/
|
|
99
|
-
testId: string;
|
|
100
|
-
/**
|
|
101
|
-
* Test name (from lookup field)
|
|
102
|
-
*/
|
|
103
|
-
testName: string;
|
|
104
|
-
/**
|
|
105
|
-
* Test execution status
|
|
106
|
-
*/
|
|
107
|
-
status: 'Passed' | 'Failed' | 'Skipped' | 'Error';
|
|
108
|
-
/**
|
|
109
|
-
* Overall score (0.0000 to 1.0000)
|
|
110
|
-
*/
|
|
111
|
-
score: number;
|
|
112
|
-
/**
|
|
113
|
-
* Number of checks that passed
|
|
114
|
-
*/
|
|
115
|
-
passedChecks: number;
|
|
116
|
-
/**
|
|
117
|
-
* Number of checks that failed
|
|
118
|
-
*/
|
|
119
|
-
failedChecks: number;
|
|
120
|
-
/**
|
|
121
|
-
* Total number of checks
|
|
122
|
-
*/
|
|
123
|
-
totalChecks: number;
|
|
124
|
-
/**
|
|
125
|
-
* Oracle evaluation results
|
|
126
|
-
*/
|
|
127
|
-
oracleResults: OracleResult[];
|
|
128
|
-
/**
|
|
129
|
-
* Target entity type (e.g., "AI Agent")
|
|
130
|
-
*/
|
|
131
|
-
targetType: string;
|
|
132
|
-
/**
|
|
133
|
-
* Target entity ID (e.g., AIAgentRun.ID)
|
|
134
|
-
*/
|
|
135
|
-
targetLogId: string;
|
|
136
|
-
/**
|
|
137
|
-
* Execution duration in milliseconds
|
|
138
|
-
*/
|
|
139
|
-
durationMs: number;
|
|
140
|
-
/**
|
|
141
|
-
* Cost in USD
|
|
142
|
-
*/
|
|
143
|
-
totalCost: number;
|
|
144
|
-
/**
|
|
145
|
-
* When execution started
|
|
146
|
-
*/
|
|
147
|
-
startedAt: Date;
|
|
148
|
-
/**
|
|
149
|
-
* When execution completed
|
|
150
|
-
*/
|
|
151
|
-
completedAt: Date;
|
|
152
|
-
/**
|
|
153
|
-
* Error message if status is Error
|
|
154
|
-
*/
|
|
155
|
-
errorMessage?: string;
|
|
156
|
-
/**
|
|
157
|
-
* Iteration number for repeated tests (when RepeatCount > 1)
|
|
158
|
-
*/
|
|
159
|
-
sequence?: number;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Result from running a test suite
|
|
163
|
-
*/
|
|
164
|
-
export interface TestSuiteRunResult {
|
|
165
|
-
/**
|
|
166
|
-
* Suite Run ID
|
|
167
|
-
*/
|
|
168
|
-
suiteRunId: string;
|
|
169
|
-
/**
|
|
170
|
-
* Suite ID
|
|
171
|
-
*/
|
|
172
|
-
suiteId: string;
|
|
173
|
-
/**
|
|
174
|
-
* Suite name (from lookup field)
|
|
175
|
-
*/
|
|
176
|
-
suiteName: string;
|
|
177
|
-
/**
|
|
178
|
-
* Suite execution status
|
|
179
|
-
*/
|
|
180
|
-
status: 'Completed' | 'Failed' | 'Cancelled' | 'Pending' | 'Running';
|
|
181
|
-
/**
|
|
182
|
-
* Tests that passed
|
|
183
|
-
*/
|
|
184
|
-
passedTests: number;
|
|
185
|
-
/**
|
|
186
|
-
* Tests that failed
|
|
187
|
-
*/
|
|
188
|
-
failedTests: number;
|
|
189
|
-
/**
|
|
190
|
-
* Total tests
|
|
191
|
-
*/
|
|
192
|
-
totalTests: number;
|
|
193
|
-
/**
|
|
194
|
-
* Average score across all tests
|
|
195
|
-
*/
|
|
196
|
-
averageScore: number;
|
|
197
|
-
/**
|
|
198
|
-
* Individual test results
|
|
199
|
-
*/
|
|
200
|
-
testResults: TestRunResult[];
|
|
201
|
-
/**
|
|
202
|
-
* Total duration in milliseconds
|
|
203
|
-
*/
|
|
204
|
-
durationMs: number;
|
|
205
|
-
/**
|
|
206
|
-
* Total cost in USD
|
|
207
|
-
*/
|
|
208
|
-
totalCost: number;
|
|
209
|
-
/**
|
|
210
|
-
* When execution started
|
|
211
|
-
*/
|
|
212
|
-
startedAt: Date;
|
|
213
|
-
/**
|
|
214
|
-
* When execution completed
|
|
215
|
-
*/
|
|
216
|
-
completedAt: Date;
|
|
217
|
-
}
|
|
10
|
+
export { TestLogMessage, TestProgress, TestRunOptions, SuiteRunOptions, OracleResult, TestRunResult, TestSuiteRunResult, ScoringWeights, ValidationResult, ValidationError, ValidationWarning, RunContextDetails, OracleConfig } from '@memberjunction/testing-engine-base';
|
|
11
|
+
import { TestRunOptions, OracleResult } from '@memberjunction/testing-engine-base';
|
|
218
12
|
/**
|
|
219
13
|
* Context for test driver execution
|
|
220
14
|
*/
|
|
@@ -278,9 +72,17 @@ export interface TurnResult {
|
|
|
278
72
|
*/
|
|
279
73
|
export interface DriverExecutionResult {
|
|
280
74
|
/**
|
|
281
|
-
*
|
|
75
|
+
* Optional sub-category or variant label for the test target.
|
|
76
|
+
* Use for ad-hoc labeling or to distinguish test scenarios within the same entity type.
|
|
77
|
+
* Examples: "Summarization", "Classification", "Code Review", "Multi-turn Chat"
|
|
282
78
|
*/
|
|
283
79
|
targetType: string;
|
|
80
|
+
/**
|
|
81
|
+
* Entity ID identifying the type of target being tested.
|
|
82
|
+
* References Entity.ID (e.g., Entity ID for "MJ: AI Agent Runs").
|
|
83
|
+
* This is the proper FK reference for entity linkage.
|
|
84
|
+
*/
|
|
85
|
+
targetLogEntityId?: string;
|
|
284
86
|
/**
|
|
285
87
|
* Target entity ID (final AgentRun ID for single/multi-turn)
|
|
286
88
|
*/
|
|
@@ -288,7 +90,7 @@ export interface DriverExecutionResult {
|
|
|
288
90
|
/**
|
|
289
91
|
* Execution status
|
|
290
92
|
*/
|
|
291
|
-
status: 'Passed' | 'Failed' | 'Error';
|
|
93
|
+
status: 'Passed' | 'Failed' | 'Error' | 'Timeout';
|
|
292
94
|
/**
|
|
293
95
|
* Overall score
|
|
294
96
|
*/
|
|
@@ -371,103 +173,4 @@ export interface OracleInput {
|
|
|
371
173
|
*/
|
|
372
174
|
contextUser: UserInfo;
|
|
373
175
|
}
|
|
374
|
-
/**
|
|
375
|
-
* Oracle configuration (can have any additional properties)
|
|
376
|
-
*/
|
|
377
|
-
export interface OracleConfig {
|
|
378
|
-
/**
|
|
379
|
-
* Oracle-specific configuration properties
|
|
380
|
-
*/
|
|
381
|
-
[key: string]: unknown;
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Oracle evaluation result
|
|
385
|
-
*/
|
|
386
|
-
export interface OracleResult {
|
|
387
|
-
/**
|
|
388
|
-
* Oracle type that produced this result
|
|
389
|
-
*/
|
|
390
|
-
oracleType: string;
|
|
391
|
-
/**
|
|
392
|
-
* Whether the oracle check passed
|
|
393
|
-
*/
|
|
394
|
-
passed: boolean;
|
|
395
|
-
/**
|
|
396
|
-
* Numeric score (0.0 to 1.0)
|
|
397
|
-
*/
|
|
398
|
-
score: number;
|
|
399
|
-
/**
|
|
400
|
-
* Human-readable message
|
|
401
|
-
*/
|
|
402
|
-
message: string;
|
|
403
|
-
/**
|
|
404
|
-
* Additional details (oracle-specific)
|
|
405
|
-
*/
|
|
406
|
-
details?: unknown;
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Scoring weights for different evaluation dimensions
|
|
410
|
-
*/
|
|
411
|
-
export interface ScoringWeights {
|
|
412
|
-
/**
|
|
413
|
-
* Weight for each oracle type
|
|
414
|
-
* Keys are oracle types, values are weights (should sum to 1.0)
|
|
415
|
-
*/
|
|
416
|
-
[oracleType: string]: number;
|
|
417
|
-
}
|
|
418
|
-
/**
|
|
419
|
-
* Validation result for test configuration
|
|
420
|
-
*/
|
|
421
|
-
export interface ValidationResult {
|
|
422
|
-
/**
|
|
423
|
-
* Whether validation passed
|
|
424
|
-
*/
|
|
425
|
-
valid: boolean;
|
|
426
|
-
/**
|
|
427
|
-
* Validation errors (blocking issues)
|
|
428
|
-
*/
|
|
429
|
-
errors: ValidationError[];
|
|
430
|
-
/**
|
|
431
|
-
* Validation warnings (non-blocking issues)
|
|
432
|
-
*/
|
|
433
|
-
warnings: ValidationWarning[];
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Validation error
|
|
437
|
-
*/
|
|
438
|
-
export interface ValidationError {
|
|
439
|
-
/**
|
|
440
|
-
* Error category
|
|
441
|
-
*/
|
|
442
|
-
category: 'configuration' | 'input' | 'expected-outcome';
|
|
443
|
-
/**
|
|
444
|
-
* Error message
|
|
445
|
-
*/
|
|
446
|
-
message: string;
|
|
447
|
-
/**
|
|
448
|
-
* Field path (if applicable)
|
|
449
|
-
*/
|
|
450
|
-
field?: string;
|
|
451
|
-
/**
|
|
452
|
-
* Suggested fix
|
|
453
|
-
*/
|
|
454
|
-
suggestion?: string;
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Validation warning
|
|
458
|
-
*/
|
|
459
|
-
export interface ValidationWarning {
|
|
460
|
-
/**
|
|
461
|
-
* Warning category
|
|
462
|
-
*/
|
|
463
|
-
category: 'best-practice' | 'performance' | 'cost';
|
|
464
|
-
/**
|
|
465
|
-
* Warning message
|
|
466
|
-
*/
|
|
467
|
-
message: string;
|
|
468
|
-
/**
|
|
469
|
-
* Recommendation
|
|
470
|
-
*/
|
|
471
|
-
recommendation?: string;
|
|
472
|
-
}
|
|
473
176
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[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AQ,CAAC;CACvB"}
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* Core type definitions for the Testing Engine
|
|
4
|
+
*
|
|
5
|
+
* Note: UI-safe types are defined in @memberjunction/testing-engine-base
|
|
6
|
+
* This file contains execution-specific types that depend on engine internals
|
|
4
7
|
*/
|
|
5
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
9
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Utility functions for gathering execution context
|
|
3
|
+
* @module @memberjunction/testing-engine
|
|
4
|
+
*/
|
|
5
|
+
import { RunContextDetails } from '@memberjunction/testing-engine-base';
|
|
6
|
+
/**
|
|
7
|
+
* Gather execution context details for test runs.
|
|
8
|
+
* This collects machine info, OS details, Node version, and CI/CD context.
|
|
9
|
+
*
|
|
10
|
+
* @returns RunContextDetails object with all available context
|
|
11
|
+
*/
|
|
12
|
+
export declare function gatherExecutionContext(): RunContextDetails;
|
|
13
|
+
/**
|
|
14
|
+
* Get the hostname of the current machine.
|
|
15
|
+
* @returns Machine hostname
|
|
16
|
+
*/
|
|
17
|
+
export declare function getMachineName(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Get the machine identifier (MAC address).
|
|
20
|
+
* @returns MAC address or undefined if not available
|
|
21
|
+
*/
|
|
22
|
+
export declare function getMachineIdentifier(): string | undefined;
|
|
23
|
+
//# sourceMappingURL=execution-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-context.d.ts","sourceRoot":"","sources":["../../src/utils/execution-context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AA+HxE;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,iBAAiB,CAY1D;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,GAAG,SAAS,CAEzD"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Utility functions for gathering execution context
|
|
4
|
+
* @module @memberjunction/testing-engine
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
|
+
if (mod && mod.__esModule) return mod;
|
|
24
|
+
var result = {};
|
|
25
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
+
__setModuleDefault(result, mod);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.getMachineIdentifier = exports.getMachineName = exports.gatherExecutionContext = void 0;
|
|
31
|
+
const os = __importStar(require("os"));
|
|
32
|
+
/**
|
|
33
|
+
* Get the primary MAC address for use as a machine identifier.
|
|
34
|
+
* Returns the first non-internal, non-loopback MAC address found.
|
|
35
|
+
* @returns MAC address string or undefined if not found
|
|
36
|
+
*/
|
|
37
|
+
function getMachineId() {
|
|
38
|
+
const interfaces = os.networkInterfaces();
|
|
39
|
+
for (const name of Object.keys(interfaces)) {
|
|
40
|
+
const ifaceList = interfaces[name];
|
|
41
|
+
if (!ifaceList)
|
|
42
|
+
continue;
|
|
43
|
+
for (const iface of ifaceList) {
|
|
44
|
+
// Skip internal (loopback) and interfaces without MAC
|
|
45
|
+
if (iface.internal || !iface.mac || iface.mac === '00:00:00:00:00:00') {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
return iface.mac;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get the primary IP address of the machine.
|
|
55
|
+
* Returns the first non-internal IPv4 address found.
|
|
56
|
+
* @returns IP address string or undefined if not found
|
|
57
|
+
*/
|
|
58
|
+
function getIpAddress() {
|
|
59
|
+
const interfaces = os.networkInterfaces();
|
|
60
|
+
for (const name of Object.keys(interfaces)) {
|
|
61
|
+
const ifaceList = interfaces[name];
|
|
62
|
+
if (!ifaceList)
|
|
63
|
+
continue;
|
|
64
|
+
for (const iface of ifaceList) {
|
|
65
|
+
// Skip internal (loopback) and non-IPv4
|
|
66
|
+
if (iface.internal || iface.family !== 'IPv4') {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
return iface.address;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Detect CI/CD provider from environment variables.
|
|
76
|
+
* @returns Object with CI provider info or undefined values
|
|
77
|
+
*/
|
|
78
|
+
function detectCIProvider() {
|
|
79
|
+
// GitHub Actions
|
|
80
|
+
if (process.env.GITHUB_ACTIONS === 'true') {
|
|
81
|
+
return {
|
|
82
|
+
ciProvider: 'GitHub Actions',
|
|
83
|
+
pipelineId: process.env.GITHUB_WORKFLOW,
|
|
84
|
+
buildNumber: process.env.GITHUB_RUN_NUMBER,
|
|
85
|
+
branch: process.env.GITHUB_REF_NAME || process.env.GITHUB_HEAD_REF,
|
|
86
|
+
prNumber: process.env.GITHUB_PR_NUMBER
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// Azure DevOps
|
|
90
|
+
if (process.env.TF_BUILD === 'True') {
|
|
91
|
+
return {
|
|
92
|
+
ciProvider: 'Azure DevOps',
|
|
93
|
+
pipelineId: process.env.BUILD_DEFINITIONNAME,
|
|
94
|
+
buildNumber: process.env.BUILD_BUILDNUMBER,
|
|
95
|
+
branch: process.env.BUILD_SOURCEBRANCH,
|
|
96
|
+
prNumber: process.env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
// Jenkins
|
|
100
|
+
if (process.env.JENKINS_URL) {
|
|
101
|
+
return {
|
|
102
|
+
ciProvider: 'Jenkins',
|
|
103
|
+
pipelineId: process.env.JOB_NAME,
|
|
104
|
+
buildNumber: process.env.BUILD_NUMBER,
|
|
105
|
+
branch: process.env.GIT_BRANCH || process.env.BRANCH_NAME,
|
|
106
|
+
prNumber: process.env.CHANGE_ID
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
// CircleCI
|
|
110
|
+
if (process.env.CIRCLECI === 'true') {
|
|
111
|
+
return {
|
|
112
|
+
ciProvider: 'CircleCI',
|
|
113
|
+
pipelineId: process.env.CIRCLE_WORKFLOW_ID,
|
|
114
|
+
buildNumber: process.env.CIRCLE_BUILD_NUM,
|
|
115
|
+
branch: process.env.CIRCLE_BRANCH,
|
|
116
|
+
prNumber: process.env.CIRCLE_PR_NUMBER
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
// GitLab CI
|
|
120
|
+
if (process.env.GITLAB_CI === 'true') {
|
|
121
|
+
return {
|
|
122
|
+
ciProvider: 'GitLab CI',
|
|
123
|
+
pipelineId: process.env.CI_PIPELINE_ID,
|
|
124
|
+
buildNumber: process.env.CI_JOB_ID,
|
|
125
|
+
branch: process.env.CI_COMMIT_REF_NAME,
|
|
126
|
+
prNumber: process.env.CI_MERGE_REQUEST_IID
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
// Travis CI
|
|
130
|
+
if (process.env.TRAVIS === 'true') {
|
|
131
|
+
return {
|
|
132
|
+
ciProvider: 'Travis CI',
|
|
133
|
+
pipelineId: process.env.TRAVIS_JOB_ID,
|
|
134
|
+
buildNumber: process.env.TRAVIS_BUILD_NUMBER,
|
|
135
|
+
branch: process.env.TRAVIS_BRANCH,
|
|
136
|
+
prNumber: process.env.TRAVIS_PULL_REQUEST !== 'false' ? process.env.TRAVIS_PULL_REQUEST : undefined
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
// Not in CI
|
|
140
|
+
return {};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Gather execution context details for test runs.
|
|
144
|
+
* This collects machine info, OS details, Node version, and CI/CD context.
|
|
145
|
+
*
|
|
146
|
+
* @returns RunContextDetails object with all available context
|
|
147
|
+
*/
|
|
148
|
+
function gatherExecutionContext() {
|
|
149
|
+
const ciInfo = detectCIProvider();
|
|
150
|
+
return {
|
|
151
|
+
osType: os.platform(),
|
|
152
|
+
osVersion: os.release(),
|
|
153
|
+
nodeVersion: process.version,
|
|
154
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
155
|
+
locale: Intl.DateTimeFormat().resolvedOptions().locale,
|
|
156
|
+
ipAddress: getIpAddress(),
|
|
157
|
+
...ciInfo
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
exports.gatherExecutionContext = gatherExecutionContext;
|
|
161
|
+
/**
|
|
162
|
+
* Get the hostname of the current machine.
|
|
163
|
+
* @returns Machine hostname
|
|
164
|
+
*/
|
|
165
|
+
function getMachineName() {
|
|
166
|
+
return os.hostname();
|
|
167
|
+
}
|
|
168
|
+
exports.getMachineName = getMachineName;
|
|
169
|
+
/**
|
|
170
|
+
* Get the machine identifier (MAC address).
|
|
171
|
+
* @returns MAC address or undefined if not available
|
|
172
|
+
*/
|
|
173
|
+
function getMachineIdentifier() {
|
|
174
|
+
return getMachineId();
|
|
175
|
+
}
|
|
176
|
+
exports.getMachineIdentifier = getMachineIdentifier;
|
|
177
|
+
//# sourceMappingURL=execution-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-context.js","sourceRoot":"","sources":["../../src/utils/execution-context.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AAGzB;;;;GAIG;AACH,SAAS,YAAY;IACjB,MAAM,UAAU,GAAG,EAAE,CAAC,iBAAiB,EAAE,CAAC;IAC1C,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACzC,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,SAAS;YAAE,SAAS;QAEzB,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE,CAAC;YAC5B,sDAAsD;YACtD,IAAI,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,KAAK,mBAAmB,EAAE,CAAC;gBACpE,SAAS;YACb,CAAC;YACD,OAAO,KAAK,CAAC,GAAG,CAAC;QACrB,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,SAAS,YAAY;IACjB,MAAM,UAAU,G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C,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa;YACjC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS;SACtG,CAAC;IACN,CAAC;IAED,YAAY;IACZ,OAAO,EAAE,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAgB,sBAAsB;IAClC,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAC;IAElC,OAAO;QACH,MAAM,EAAE,EAAE,CAAC,QAAQ,EAAE;QACrB,SAAS,EAAE,EAAE,CAAC,OAAO,EAAE;QACvB,WAAW,EAAE,OAAO,CAAC,OAAO;QAC5B,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,QAAQ;QAC1D,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,MAAM;QACtD,SAAS,EAAE,YAAY,EAAE;QACzB,GAAG,MAAM;KACZ,CAAC;AACN,CAAC;AAZD,wDAYC;AAED;;;GAGG;AACH,SAAgB,cAAc;IAC1B,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;AACzB,CAAC;AAFD,wCAEC;AAED;;;GAGG;AACH,SAAgB,oBAAoB;IAChC,OAAO,YAAY,EAAE,CAAC;AAC1B,CAAC;AAFD,oDAEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/testing-engine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.130.0",
|
|
4
4
|
"description": "MemberJunction Testing Framework Engine - Core test execution and evaluation engine supporting multiple test types",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
"@types/debug": "^4.1.12"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@memberjunction/ai": "2.
|
|
24
|
-
"@memberjunction/ai-agents": "2.
|
|
25
|
-
"@memberjunction/ai-core-plus": "2.
|
|
26
|
-
"@memberjunction/ai-prompts": "2.
|
|
27
|
-
"@memberjunction/aiengine": "2.
|
|
28
|
-
"@memberjunction/core": "2.
|
|
29
|
-
"@memberjunction/core-entities": "2.
|
|
30
|
-
"@memberjunction/global": "2.
|
|
31
|
-
"@memberjunction/testing-engine-base": "2.
|
|
23
|
+
"@memberjunction/ai": "2.130.0",
|
|
24
|
+
"@memberjunction/ai-agents": "2.130.0",
|
|
25
|
+
"@memberjunction/ai-core-plus": "2.130.0",
|
|
26
|
+
"@memberjunction/ai-prompts": "2.130.0",
|
|
27
|
+
"@memberjunction/aiengine": "2.130.0",
|
|
28
|
+
"@memberjunction/core": "2.130.0",
|
|
29
|
+
"@memberjunction/core-entities": "2.130.0",
|
|
30
|
+
"@memberjunction/global": "2.130.0",
|
|
31
|
+
"@memberjunction/testing-engine-base": "2.130.0",
|
|
32
32
|
"debug": "^4.4.0",
|
|
33
33
|
"rxjs": "^7.8.1",
|
|
34
34
|
"zod": "^3.23.8"
|