elasticdash-test 0.1.20-alpha-11 → 0.1.20-alpha-12
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-registry.d.ts","sourceRoot":"","sources":["../../src/ci/test-registry.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,WAAW,GAAG,SAAS,CAAA;IAC7B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,UAAU,CAAA;IAClB,UAAU,EAAE,cAAc,CAAA;IAC1B,2FAA2F;IAC3F,GAAG,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;
|
|
1
|
+
{"version":3,"file":"test-registry.d.ts","sourceRoot":"","sources":["../../src/ci/test-registry.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,WAAW,GAAG,SAAS,CAAA;IAC7B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,UAAU,CAAA;IAClB,UAAU,EAAE,cAAc,CAAA;IAC1B,2FAA2F;IAC3F,GAAG,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAWD,wBAAgB,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,GAAG,IAAI,CAEzE;AAED,wBAAgB,eAAe,IAAI,cAAc,EAAE,CAElD;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
|
package/dist/ci/test-registry.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
// Use a globalThis-backed registry so that the CLI (global install) and the
|
|
2
|
+
// test file (local node_modules) share the same array even when they resolve
|
|
3
|
+
// to different module instances.
|
|
4
|
+
const g = globalThis;
|
|
5
|
+
const ED_TEST_REGISTRY_KEY = '__elasticdash_ed_test_registry__';
|
|
6
|
+
const registry = g[ED_TEST_REGISTRY_KEY] ?? [];
|
|
7
|
+
if (!g[ED_TEST_REGISTRY_KEY])
|
|
8
|
+
g[ED_TEST_REGISTRY_KEY] = registry;
|
|
2
9
|
export function defineTest(def) {
|
|
3
10
|
registry.push({ ...def });
|
|
4
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-registry.js","sourceRoot":"","sources":["../../src/ci/test-registry.ts"],"names":[],"mappings":"AAuBA,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"test-registry.js","sourceRoot":"","sources":["../../src/ci/test-registry.ts"],"names":[],"mappings":"AAuBA,4EAA4E;AAC5E,6EAA6E;AAC7E,iCAAiC;AACjC,MAAM,CAAC,GAAG,UAAqC,CAAA;AAC/C,MAAM,oBAAoB,GAAG,kCAAkC,CAAA;AAC/D,MAAM,QAAQ,GACX,CAAC,CAAC,oBAAoB,CAAsB,IAAI,EAAE,CAAA;AACrD,IAAI,CAAC,CAAC,CAAC,oBAAoB,CAAC;IAAE,CAAC,CAAC,oBAAoB,CAAC,GAAG,QAAQ,CAAA;AAEhE,MAAM,UAAU,UAAU,CAAC,GAAwC;IACjE,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,CAAA;AAC3B,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAA;AACtB,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAA;AACrB,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -926,15 +926,15 @@ function normaliseMockResult(value) {
|
|
|
926
926
|
return value;
|
|
927
927
|
}
|
|
928
928
|
function resolveMock(toolName) {
|
|
929
|
-
const
|
|
930
|
-
const mocks =
|
|
929
|
+
const g7 = globalThis;
|
|
930
|
+
const mocks = g7["__ELASTICDASH_TOOL_MOCKS__"];
|
|
931
931
|
if (!mocks) return { mocked: false };
|
|
932
932
|
const entry = mocks[toolName];
|
|
933
933
|
if (!entry || entry.mode === "live") return { mocked: false };
|
|
934
|
-
if (!
|
|
935
|
-
|
|
934
|
+
if (!g7["__ELASTICDASH_TOOL_CALL_COUNTERS__"]) {
|
|
935
|
+
g7["__ELASTICDASH_TOOL_CALL_COUNTERS__"] = {};
|
|
936
936
|
}
|
|
937
|
-
const counters =
|
|
937
|
+
const counters = g7["__ELASTICDASH_TOOL_CALL_COUNTERS__"];
|
|
938
938
|
counters[toolName] = (counters[toolName] ?? 0) + 1;
|
|
939
939
|
const callNumber = counters[toolName];
|
|
940
940
|
if (entry.mode === "mock-all") {
|
|
@@ -997,8 +997,8 @@ function replaceSystemPrompt(input, newSystemPrompt) {
|
|
|
997
997
|
return input;
|
|
998
998
|
}
|
|
999
999
|
function resolvePromptMock(input) {
|
|
1000
|
-
const
|
|
1001
|
-
const mocks =
|
|
1000
|
+
const g7 = globalThis;
|
|
1001
|
+
const mocks = g7["__ELASTICDASH_PROMPT_MOCKS__"];
|
|
1002
1002
|
if (!mocks || Object.keys(mocks).length === 0) return void 0;
|
|
1003
1003
|
const systemPrompt = extractSystemPrompt(input);
|
|
1004
1004
|
if (systemPrompt === void 0) return void 0;
|
|
@@ -1009,10 +1009,10 @@ function resolvePromptMock(input) {
|
|
|
1009
1009
|
return replaceSystemPrompt(input, entry);
|
|
1010
1010
|
}
|
|
1011
1011
|
if (entry.mode === "live") return void 0;
|
|
1012
|
-
if (!
|
|
1013
|
-
|
|
1012
|
+
if (!g7["__ELASTICDASH_PROMPT_CALL_COUNTERS__"]) {
|
|
1013
|
+
g7["__ELASTICDASH_PROMPT_CALL_COUNTERS__"] = {};
|
|
1014
1014
|
}
|
|
1015
|
-
const counters =
|
|
1015
|
+
const counters = g7["__ELASTICDASH_PROMPT_CALL_COUNTERS__"];
|
|
1016
1016
|
counters[match.key] = (counters[match.key] ?? 0) + 1;
|
|
1017
1017
|
const callNumber = counters[match.key];
|
|
1018
1018
|
if (entry.mode === "replace-all") {
|
|
@@ -1075,15 +1075,15 @@ function replaceUserPrompt(input, originalText, newText) {
|
|
|
1075
1075
|
return input;
|
|
1076
1076
|
}
|
|
1077
1077
|
function resolveUserPromptMock(input) {
|
|
1078
|
-
const
|
|
1079
|
-
const mocks =
|
|
1078
|
+
const g7 = globalThis;
|
|
1079
|
+
const mocks = g7["__ELASTICDASH_USER_PROMPT_MOCKS__"];
|
|
1080
1080
|
if (!mocks || Object.keys(mocks).length === 0) return void 0;
|
|
1081
1081
|
const userPrompts = extractUserPrompts(input);
|
|
1082
1082
|
if (userPrompts.length === 0) return void 0;
|
|
1083
|
-
if (!
|
|
1084
|
-
|
|
1083
|
+
if (!g7["__ELASTICDASH_USER_PROMPT_CALL_COUNTERS__"]) {
|
|
1084
|
+
g7["__ELASTICDASH_USER_PROMPT_CALL_COUNTERS__"] = {};
|
|
1085
1085
|
}
|
|
1086
|
-
const counters =
|
|
1086
|
+
const counters = g7["__ELASTICDASH_USER_PROMPT_CALL_COUNTERS__"];
|
|
1087
1087
|
const uniqueTexts = Array.from(new Set(userPrompts));
|
|
1088
1088
|
let modified = false;
|
|
1089
1089
|
let result = input;
|
|
@@ -1159,15 +1159,15 @@ function applySystemPromptMocks(input, promptMocks, callCounters) {
|
|
|
1159
1159
|
return input;
|
|
1160
1160
|
}
|
|
1161
1161
|
function resolveAIMock(modelName) {
|
|
1162
|
-
const
|
|
1163
|
-
const mocks =
|
|
1162
|
+
const g7 = globalThis;
|
|
1163
|
+
const mocks = g7["__ELASTICDASH_AI_MOCKS__"];
|
|
1164
1164
|
if (!mocks) return { mocked: false };
|
|
1165
1165
|
const entry = mocks[modelName];
|
|
1166
1166
|
if (!entry || entry.mode === "live") return { mocked: false };
|
|
1167
|
-
if (!
|
|
1168
|
-
|
|
1167
|
+
if (!g7["__ELASTICDASH_AI_CALL_COUNTERS__"]) {
|
|
1168
|
+
g7["__ELASTICDASH_AI_CALL_COUNTERS__"] = {};
|
|
1169
1169
|
}
|
|
1170
|
-
const counters =
|
|
1170
|
+
const counters = g7["__ELASTICDASH_AI_CALL_COUNTERS__"];
|
|
1171
1171
|
counters[modelName] = (counters[modelName] ?? 0) + 1;
|
|
1172
1172
|
const callNumber = counters[modelName];
|
|
1173
1173
|
if (entry.mode === "mock-all") {
|
|
@@ -1538,9 +1538,9 @@ function isAIWrapperActive() {
|
|
|
1538
1538
|
return (globalThis[AI_WRAPPER_KEY] ?? 0) > 0;
|
|
1539
1539
|
}
|
|
1540
1540
|
function consumeCapturedLLMRequest() {
|
|
1541
|
-
const
|
|
1542
|
-
const req =
|
|
1543
|
-
if (req)
|
|
1541
|
+
const g7 = globalThis;
|
|
1542
|
+
const req = g7[LLM_REQUEST_KEY];
|
|
1543
|
+
if (req) g7[LLM_REQUEST_KEY] = void 0;
|
|
1544
1544
|
return req;
|
|
1545
1545
|
}
|
|
1546
1546
|
function extractPromptSnippet(body) {
|
|
@@ -5130,9 +5130,9 @@ function wrapTool(name, fn) {
|
|
|
5130
5130
|
}
|
|
5131
5131
|
return replayed;
|
|
5132
5132
|
}
|
|
5133
|
-
const
|
|
5134
|
-
const prev =
|
|
5135
|
-
|
|
5133
|
+
const g7 = globalThis;
|
|
5134
|
+
const prev = g7[TOOL_WRAPPER_ACTIVE_KEY];
|
|
5135
|
+
g7[TOOL_WRAPPER_ACTIVE_KEY] = true;
|
|
5136
5136
|
const start = rawDateNow();
|
|
5137
5137
|
try {
|
|
5138
5138
|
const output = await fn(...args);
|
|
@@ -5186,8 +5186,8 @@ function wrapTool(name, fn) {
|
|
|
5186
5186
|
}
|
|
5187
5187
|
throw e;
|
|
5188
5188
|
} finally {
|
|
5189
|
-
if (prev === void 0) delete
|
|
5190
|
-
else
|
|
5189
|
+
if (prev === void 0) delete g7[TOOL_WRAPPER_ACTIVE_KEY];
|
|
5190
|
+
else g7[TOOL_WRAPPER_ACTIVE_KEY] = prev;
|
|
5191
5191
|
}
|
|
5192
5192
|
};
|
|
5193
5193
|
}
|
|
@@ -6051,7 +6051,10 @@ async function discoverTestFiles(options) {
|
|
|
6051
6051
|
}
|
|
6052
6052
|
|
|
6053
6053
|
// src/ci/test-registry.ts
|
|
6054
|
-
var
|
|
6054
|
+
var g6 = globalThis;
|
|
6055
|
+
var ED_TEST_REGISTRY_KEY = "__elasticdash_ed_test_registry__";
|
|
6056
|
+
var registry = g6[ED_TEST_REGISTRY_KEY] ?? [];
|
|
6057
|
+
if (!g6[ED_TEST_REGISTRY_KEY]) g6[ED_TEST_REGISTRY_KEY] = registry;
|
|
6055
6058
|
function defineTest(def) {
|
|
6056
6059
|
registry.push({ ...def });
|
|
6057
6060
|
}
|
|
@@ -7096,7 +7099,7 @@ async function runCI(config) {
|
|
|
7096
7099
|
results: []
|
|
7097
7100
|
};
|
|
7098
7101
|
}
|
|
7099
|
-
const totalTests = testGroups.reduce((sum,
|
|
7102
|
+
const totalTests = testGroups.reduce((sum, g7) => sum + g7.tests.length, 0);
|
|
7100
7103
|
console.log(import_chalk2.default.cyan(`[elasticdash ci] Found ${testGroups.length} test group(s), ${totalTests} test(s) total.
|
|
7101
7104
|
`));
|
|
7102
7105
|
const allResults = [];
|
package/package.json
CHANGED
package/src/ci/test-registry.ts
CHANGED
|
@@ -21,7 +21,14 @@ export interface TestDefinition {
|
|
|
21
21
|
_sourceFile?: string
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
// Use a globalThis-backed registry so that the CLI (global install) and the
|
|
25
|
+
// test file (local node_modules) share the same array even when they resolve
|
|
26
|
+
// to different module instances.
|
|
27
|
+
const g = globalThis as Record<string, unknown>
|
|
28
|
+
const ED_TEST_REGISTRY_KEY = '__elasticdash_ed_test_registry__'
|
|
29
|
+
const registry: TestDefinition[] =
|
|
30
|
+
(g[ED_TEST_REGISTRY_KEY] as TestDefinition[]) ?? []
|
|
31
|
+
if (!g[ED_TEST_REGISTRY_KEY]) g[ED_TEST_REGISTRY_KEY] = registry
|
|
25
32
|
|
|
26
33
|
export function defineTest(def: Omit<TestDefinition, '_sourceFile'>): void {
|
|
27
34
|
registry.push({ ...def })
|