@arizeai/phoenix-client 6.10.0 → 6.11.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/README.md +62 -0
- package/dist/esm/__generated__/api/v1.d.ts +452 -28
- package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
- package/dist/esm/experiments/helpers/getExampleGlobalId.d.ts +8 -0
- package/dist/esm/experiments/helpers/getExampleGlobalId.d.ts.map +1 -0
- package/dist/esm/experiments/helpers/getExampleGlobalId.js +9 -0
- package/dist/esm/experiments/helpers/getExampleGlobalId.js.map +1 -0
- package/dist/esm/experiments/resumeEvaluation.d.ts.map +1 -1
- package/dist/esm/experiments/resumeEvaluation.js +2 -1
- package/dist/esm/experiments/resumeEvaluation.js.map +1 -1
- package/dist/esm/experiments/resumeExperiment.d.ts.map +1 -1
- package/dist/esm/experiments/resumeExperiment.js +3 -2
- package/dist/esm/experiments/resumeExperiment.js.map +1 -1
- package/dist/esm/experiments/runExperiment.d.ts.map +1 -1
- package/dist/esm/experiments/runExperiment.js +6 -3
- package/dist/esm/experiments/runExperiment.js.map +1 -1
- package/dist/esm/jest/index.d.ts +5 -0
- package/dist/esm/jest/index.d.ts.map +1 -0
- package/dist/esm/jest/index.js +49 -0
- package/dist/esm/jest/index.js.map +1 -0
- package/dist/esm/jest/reporter.d.ts +13 -0
- package/dist/esm/jest/reporter.d.ts.map +1 -0
- package/dist/esm/jest/reporter.js +19 -0
- package/dist/esm/jest/reporter.js.map +1 -0
- package/dist/esm/prompts/sdks/toAI.d.ts +2 -2
- package/dist/esm/prompts/sdks/toAI.d.ts.map +1 -1
- package/dist/esm/prompts/sdks/toAI.js.map +1 -1
- package/dist/esm/prompts/sdks/toAnthropic.d.ts +2 -2
- package/dist/esm/prompts/sdks/toAnthropic.d.ts.map +1 -1
- package/dist/esm/prompts/sdks/toAnthropic.js.map +1 -1
- package/dist/esm/prompts/sdks/toOpenAI.d.ts +2 -2
- package/dist/esm/prompts/sdks/toOpenAI.d.ts.map +1 -1
- package/dist/esm/prompts/sdks/toOpenAI.js.map +1 -1
- package/dist/esm/prompts/sdks/toSDK.d.ts +8 -8
- package/dist/esm/prompts/sdks/toSDK.d.ts.map +1 -1
- package/dist/esm/prompts/sdks/toSDK.js.map +1 -1
- package/dist/esm/prompts/sdks/types.d.ts +2 -2
- package/dist/esm/prompts/sdks/types.d.ts.map +1 -1
- package/dist/esm/schemas/llm/anthropic/converters.d.ts +8 -8
- package/dist/esm/schemas/llm/anthropic/messagePartSchemas.d.ts +4 -4
- package/dist/esm/schemas/llm/anthropic/messageSchemas.d.ts +6 -6
- package/dist/esm/schemas/llm/constants.d.ts +3 -3
- package/dist/esm/schemas/llm/converters.d.ts +12 -12
- package/dist/esm/schemas/llm/openai/converters.d.ts +3 -3
- package/dist/esm/schemas/llm/schemas.d.ts +2 -2
- package/dist/esm/testing/acceptance.d.ts +20 -0
- package/dist/esm/testing/acceptance.d.ts.map +1 -0
- package/dist/esm/testing/acceptance.js +129 -0
- package/dist/esm/testing/acceptance.js.map +1 -0
- package/dist/esm/testing/define-api.d.ts +157 -0
- package/dist/esm/testing/define-api.d.ts.map +1 -0
- package/dist/esm/testing/define-api.js +78 -0
- package/dist/esm/testing/define-api.js.map +1 -0
- package/dist/esm/testing/helpers.d.ts +55 -0
- package/dist/esm/testing/helpers.d.ts.map +1 -0
- package/dist/esm/testing/helpers.js +179 -0
- package/dist/esm/testing/helpers.js.map +1 -0
- package/dist/esm/testing/phoenix-test-tracking.d.ts +68 -0
- package/dist/esm/testing/phoenix-test-tracking.d.ts.map +1 -0
- package/dist/esm/testing/phoenix-test-tracking.js +521 -0
- package/dist/esm/testing/phoenix-test-tracking.js.map +1 -0
- package/dist/esm/testing/report-artifacts.d.ts +45 -0
- package/dist/esm/testing/report-artifacts.d.ts.map +1 -0
- package/dist/esm/testing/report-artifacts.js +218 -0
- package/dist/esm/testing/report-artifacts.js.map +1 -0
- package/dist/esm/testing/report-run.d.ts +22 -0
- package/dist/esm/testing/report-run.d.ts.map +1 -0
- package/dist/esm/testing/report-run.js +41 -0
- package/dist/esm/testing/report-run.js.map +1 -0
- package/dist/esm/testing/reporter-format.d.ts +83 -0
- package/dist/esm/testing/reporter-format.d.ts.map +1 -0
- package/dist/esm/testing/reporter-format.js +852 -0
- package/dist/esm/testing/reporter-format.js.map +1 -0
- package/dist/esm/testing/runner.d.ts +31 -0
- package/dist/esm/testing/runner.d.ts.map +1 -0
- package/dist/esm/testing/runner.js +238 -0
- package/dist/esm/testing/runner.js.map +1 -0
- package/dist/esm/testing/state.d.ts +138 -0
- package/dist/esm/testing/state.d.ts.map +1 -0
- package/dist/esm/testing/state.js +31 -0
- package/dist/esm/testing/state.js.map +1 -0
- package/dist/esm/testing/types.d.ts +319 -0
- package/dist/esm/testing/types.d.ts.map +1 -0
- package/dist/esm/testing/types.js +9 -0
- package/dist/esm/testing/types.js.map +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/utils/channel.d.ts +7 -7
- package/dist/esm/utils/channel.d.ts.map +1 -1
- package/dist/esm/utils/channel.js +1 -1
- package/dist/esm/utils/channel.js.map +1 -1
- package/dist/esm/utils/formatPromptMessages.d.ts.map +1 -1
- package/dist/esm/utils/getPromptBySelector.d.ts.map +1 -1
- package/dist/esm/utils/promisifyResult.d.ts +1 -1
- package/dist/esm/utils/promisifyResult.d.ts.map +1 -1
- package/dist/esm/utils/promisifyResult.js.map +1 -1
- package/dist/esm/utils/schemaMatches.d.ts +5 -5
- package/dist/esm/utils/schemaMatches.d.ts.map +1 -1
- package/dist/esm/utils/schemaMatches.js.map +1 -1
- package/dist/esm/vitest/index.d.ts +5 -0
- package/dist/esm/vitest/index.d.ts.map +1 -0
- package/dist/esm/vitest/index.js +15 -0
- package/dist/esm/vitest/index.js.map +1 -0
- package/dist/esm/vitest/reporter.d.ts +19 -0
- package/dist/esm/vitest/reporter.d.ts.map +1 -0
- package/dist/esm/vitest/reporter.js +27 -0
- package/dist/esm/vitest/reporter.js.map +1 -0
- package/dist/src/__generated__/api/v1.d.ts +452 -28
- package/dist/src/__generated__/api/v1.d.ts.map +1 -1
- package/dist/src/experiments/helpers/getExampleGlobalId.d.ts +8 -0
- package/dist/src/experiments/helpers/getExampleGlobalId.d.ts.map +1 -0
- package/dist/src/experiments/helpers/getExampleGlobalId.js +13 -0
- package/dist/src/experiments/helpers/getExampleGlobalId.js.map +1 -0
- package/dist/src/experiments/resumeEvaluation.d.ts.map +1 -1
- package/dist/src/experiments/resumeEvaluation.js +2 -1
- package/dist/src/experiments/resumeEvaluation.js.map +1 -1
- package/dist/src/experiments/resumeExperiment.d.ts.map +1 -1
- package/dist/src/experiments/resumeExperiment.js +3 -2
- package/dist/src/experiments/resumeExperiment.js.map +1 -1
- package/dist/src/experiments/runExperiment.d.ts.map +1 -1
- package/dist/src/experiments/runExperiment.js +6 -3
- package/dist/src/experiments/runExperiment.js.map +1 -1
- package/dist/src/jest/index.d.ts +5 -0
- package/dist/src/jest/index.d.ts.map +1 -0
- package/dist/src/jest/index.js +58 -0
- package/dist/src/jest/index.js.map +1 -0
- package/dist/src/jest/reporter.d.ts +13 -0
- package/dist/src/jest/reporter.d.ts.map +1 -0
- package/dist/src/jest/reporter.js +23 -0
- package/dist/src/jest/reporter.js.map +1 -0
- package/dist/src/prompts/sdks/toAI.d.ts +2 -2
- package/dist/src/prompts/sdks/toAI.d.ts.map +1 -1
- package/dist/src/prompts/sdks/toAI.js.map +1 -1
- package/dist/src/prompts/sdks/toAnthropic.d.ts +2 -2
- package/dist/src/prompts/sdks/toAnthropic.d.ts.map +1 -1
- package/dist/src/prompts/sdks/toAnthropic.js.map +1 -1
- package/dist/src/prompts/sdks/toOpenAI.d.ts +2 -2
- package/dist/src/prompts/sdks/toOpenAI.d.ts.map +1 -1
- package/dist/src/prompts/sdks/toOpenAI.js.map +1 -1
- package/dist/src/prompts/sdks/toSDK.d.ts +8 -8
- package/dist/src/prompts/sdks/toSDK.d.ts.map +1 -1
- package/dist/src/prompts/sdks/toSDK.js.map +1 -1
- package/dist/src/prompts/sdks/types.d.ts +2 -2
- package/dist/src/prompts/sdks/types.d.ts.map +1 -1
- package/dist/src/schemas/llm/anthropic/converters.d.ts +8 -8
- package/dist/src/schemas/llm/anthropic/messagePartSchemas.d.ts +4 -4
- package/dist/src/schemas/llm/anthropic/messageSchemas.d.ts +6 -6
- package/dist/src/schemas/llm/constants.d.ts +3 -3
- package/dist/src/schemas/llm/converters.d.ts +12 -12
- package/dist/src/schemas/llm/openai/converters.d.ts +3 -3
- package/dist/src/schemas/llm/schemas.d.ts +2 -2
- package/dist/src/testing/acceptance.d.ts +20 -0
- package/dist/src/testing/acceptance.d.ts.map +1 -0
- package/dist/src/testing/acceptance.js +114 -0
- package/dist/src/testing/acceptance.js.map +1 -0
- package/dist/src/testing/define-api.d.ts +157 -0
- package/dist/src/testing/define-api.d.ts.map +1 -0
- package/dist/src/testing/define-api.js +81 -0
- package/dist/src/testing/define-api.js.map +1 -0
- package/dist/src/testing/helpers.d.ts +55 -0
- package/dist/src/testing/helpers.d.ts.map +1 -0
- package/dist/src/testing/helpers.js +182 -0
- package/dist/src/testing/helpers.js.map +1 -0
- package/dist/src/testing/phoenix-test-tracking.d.ts +68 -0
- package/dist/src/testing/phoenix-test-tracking.d.ts.map +1 -0
- package/dist/src/testing/phoenix-test-tracking.js +530 -0
- package/dist/src/testing/phoenix-test-tracking.js.map +1 -0
- package/dist/src/testing/report-artifacts.d.ts +45 -0
- package/dist/src/testing/report-artifacts.d.ts.map +1 -0
- package/dist/src/testing/report-artifacts.js +225 -0
- package/dist/src/testing/report-artifacts.js.map +1 -0
- package/dist/src/testing/report-run.d.ts +22 -0
- package/dist/src/testing/report-run.d.ts.map +1 -0
- package/dist/src/testing/report-run.js +47 -0
- package/dist/src/testing/report-run.js.map +1 -0
- package/dist/src/testing/reporter-format.d.ts +83 -0
- package/dist/src/testing/reporter-format.d.ts.map +1 -0
- package/dist/src/testing/reporter-format.js +870 -0
- package/dist/src/testing/reporter-format.js.map +1 -0
- package/dist/src/testing/runner.d.ts +31 -0
- package/dist/src/testing/runner.d.ts.map +1 -0
- package/dist/src/testing/runner.js +258 -0
- package/dist/src/testing/runner.js.map +1 -0
- package/dist/src/testing/state.d.ts +138 -0
- package/dist/src/testing/state.d.ts.map +1 -0
- package/dist/src/testing/state.js +38 -0
- package/dist/src/testing/state.js.map +1 -0
- package/dist/src/testing/types.d.ts +319 -0
- package/dist/src/testing/types.d.ts.map +1 -0
- package/dist/src/testing/types.js +13 -0
- package/dist/src/testing/types.js.map +1 -0
- package/dist/src/utils/channel.d.ts +7 -7
- package/dist/src/utils/channel.d.ts.map +1 -1
- package/dist/src/utils/channel.js +1 -1
- package/dist/src/utils/channel.js.map +1 -1
- package/dist/src/utils/formatPromptMessages.d.ts.map +1 -1
- package/dist/src/utils/getPromptBySelector.d.ts.map +1 -1
- package/dist/src/utils/promisifyResult.d.ts +1 -1
- package/dist/src/utils/promisifyResult.d.ts.map +1 -1
- package/dist/src/utils/promisifyResult.js.map +1 -1
- package/dist/src/utils/schemaMatches.d.ts +5 -5
- package/dist/src/utils/schemaMatches.d.ts.map +1 -1
- package/dist/src/utils/schemaMatches.js.map +1 -1
- package/dist/src/vitest/index.d.ts +5 -0
- package/dist/src/vitest/index.d.ts.map +1 -0
- package/dist/src/vitest/index.js +23 -0
- package/dist/src/vitest/index.js.map +1 -0
- package/dist/src/vitest/reporter.d.ts +19 -0
- package/dist/src/vitest/reporter.d.ts.map +1 -0
- package/dist/src/vitest/reporter.js +34 -0
- package/dist/src/vitest/reporter.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/ci-evals-annotations.mdx +190 -0
- package/docs/ci-evals-jest.mdx +78 -0
- package/docs/ci-evals-vitest.mdx +240 -0
- package/docs/ci-evals.mdx +263 -0
- package/docs/overview.mdx +9 -1
- package/package.json +49 -17
- package/src/__generated__/api/v1.ts +452 -28
- package/src/experiments/helpers/getExampleGlobalId.ts +12 -0
- package/src/experiments/resumeEvaluation.ts +2 -1
- package/src/experiments/resumeExperiment.ts +3 -2
- package/src/experiments/runExperiment.ts +6 -3
- package/src/jest/index.ts +124 -0
- package/src/jest/reporter.ts +22 -0
- package/src/prompts/sdks/toAI.ts +4 -3
- package/src/prompts/sdks/toAnthropic.ts +4 -3
- package/src/prompts/sdks/toOpenAI.ts +4 -3
- package/src/prompts/sdks/toSDK.ts +16 -11
- package/src/prompts/sdks/types.ts +2 -2
- package/src/testing/acceptance.ts +190 -0
- package/src/testing/define-api.ts +279 -0
- package/src/testing/helpers.ts +251 -0
- package/src/testing/phoenix-test-tracking.ts +637 -0
- package/src/testing/report-artifacts.ts +272 -0
- package/src/testing/report-run.ts +44 -0
- package/src/testing/reporter-format.ts +1072 -0
- package/src/testing/runner.ts +350 -0
- package/src/testing/state.ts +165 -0
- package/src/testing/types.ts +366 -0
- package/src/utils/channel.ts +17 -15
- package/src/utils/promisifyResult.ts +6 -4
- package/src/utils/schemaMatches.ts +12 -10
- package/src/vitest/index.ts +57 -0
- package/src/vitest/reporter.ts +32 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-process bridge for the end-of-run Phoenix summary.
|
|
3
|
+
*
|
|
4
|
+
* Both Vitest and Jest run test files in separate worker processes, so a
|
|
5
|
+
* suite's results live in a different process than the reporter that prints
|
|
6
|
+
* the final summary. To bridge that gap, each worker writes a small JSON
|
|
7
|
+
* artifact describing its suite to a shared temp directory when the suite
|
|
8
|
+
* finishes (see {@link writeSuiteSummaryArtifact}). At the end of the run the
|
|
9
|
+
* reporter — back in the main process — reads every artifact written since the
|
|
10
|
+
* run began (see {@link readSuiteSummaryArtifacts}) and prints them together.
|
|
11
|
+
*
|
|
12
|
+
* Everything here is best-effort: a failure to write or read an artifact must
|
|
13
|
+
* never fail a user's test, so the file system calls swallow their errors.
|
|
14
|
+
*/
|
|
15
|
+
import { createHash } from "node:crypto";
|
|
16
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync, } from "node:fs";
|
|
17
|
+
import { tmpdir } from "node:os";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
/**
|
|
20
|
+
* Env var that overrides where suite summary artifacts are written. When unset,
|
|
21
|
+
* a stable per-project subdirectory of the OS temp dir is used (see
|
|
22
|
+
* {@link getSuiteSummaryReportDir}).
|
|
23
|
+
*/
|
|
24
|
+
export const PHOENIX_TEST_REPORT_DIR_ENV_VAR = "PHOENIX_TEST_REPORT_DIR";
|
|
25
|
+
const ARTIFACT_VERSION = 1;
|
|
26
|
+
const ARTIFACT_FILE_PREFIX = "suite-";
|
|
27
|
+
let artifactCounter = 0;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the directory where suite summary artifacts are written and read.
|
|
30
|
+
*
|
|
31
|
+
* Honors {@link PHOENIX_TEST_REPORT_DIR_ENV_VAR} when set. Otherwise it derives
|
|
32
|
+
* a directory under the OS temp dir, namespaced by a hash of the current
|
|
33
|
+
* working directory so that concurrent test runs in different projects don't
|
|
34
|
+
* read each other's artifacts.
|
|
35
|
+
*/
|
|
36
|
+
export function getSuiteSummaryReportDir() {
|
|
37
|
+
const configuredReportDir = process.env[PHOENIX_TEST_REPORT_DIR_ENV_VAR];
|
|
38
|
+
if (configuredReportDir && configuredReportDir.trim().length > 0) {
|
|
39
|
+
return configuredReportDir;
|
|
40
|
+
}
|
|
41
|
+
const cwdHash = createHash("sha256")
|
|
42
|
+
.update(process.cwd())
|
|
43
|
+
.digest("hex")
|
|
44
|
+
.slice(0, 16);
|
|
45
|
+
return join(tmpdir(), "phoenix-client-test-reports", cwdHash);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Delete any artifacts left over from a previous run. The reporter calls this
|
|
49
|
+
* at the start of every run so summaries from an earlier watch-mode invocation
|
|
50
|
+
* don't bleed into the next one.
|
|
51
|
+
*/
|
|
52
|
+
export function clearSuiteSummaryArtifacts() {
|
|
53
|
+
const reportDir = getSuiteSummaryReportDir();
|
|
54
|
+
mkdirSync(reportDir, { recursive: true });
|
|
55
|
+
for (const fileName of readdirSync(reportDir)) {
|
|
56
|
+
if (!isArtifactFileName(fileName)) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
rmSync(join(reportDir, fileName), { force: true });
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Write one suite's summary to the report directory. Called from each worker
|
|
69
|
+
* when a suite finishes.
|
|
70
|
+
*
|
|
71
|
+
* The file is written to a `.tmp` path first and then atomically renamed into
|
|
72
|
+
* place, so the reader never observes a half-written artifact. Failures are
|
|
73
|
+
* intentionally swallowed — reporting must not break the user's tests.
|
|
74
|
+
*/
|
|
75
|
+
export function writeSuiteSummaryArtifact(suite) {
|
|
76
|
+
try {
|
|
77
|
+
const reportDir = getSuiteSummaryReportDir();
|
|
78
|
+
mkdirSync(reportDir, { recursive: true });
|
|
79
|
+
const artifact = {
|
|
80
|
+
version: ARTIFACT_VERSION,
|
|
81
|
+
createdAtMs: Date.now(),
|
|
82
|
+
suite: createSuiteSummary(suite),
|
|
83
|
+
};
|
|
84
|
+
const fileName = `${ARTIFACT_FILE_PREFIX}${process.pid}-${Date.now()}-${artifactCounter++}.json`;
|
|
85
|
+
const artifactPath = join(reportDir, fileName);
|
|
86
|
+
const temporaryPath = `${artifactPath}.tmp`;
|
|
87
|
+
writeFileSync(temporaryPath, JSON.stringify(artifact), "utf8");
|
|
88
|
+
renameSync(temporaryPath, artifactPath);
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
// Reporting artifacts are best-effort and should not fail user tests.
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Read back all suite summaries the workers wrote during this run, sorted by
|
|
96
|
+
* suite name for stable output.
|
|
97
|
+
*
|
|
98
|
+
* @param sinceMs - When provided, only artifacts created at or after this
|
|
99
|
+
* timestamp are returned, so summaries from a previous run that share the
|
|
100
|
+
* report directory are ignored. A one-second slack is allowed to absorb
|
|
101
|
+
* small clock differences between worker processes.
|
|
102
|
+
*/
|
|
103
|
+
export function readSuiteSummaryArtifacts({ sinceMs, } = {}) {
|
|
104
|
+
const reportDir = getSuiteSummaryReportDir();
|
|
105
|
+
if (!existsSync(reportDir)) {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
const suites = [];
|
|
109
|
+
for (const fileName of readdirSync(reportDir)) {
|
|
110
|
+
if (!fileName.startsWith(ARTIFACT_FILE_PREFIX) ||
|
|
111
|
+
!fileName.endsWith(".json")) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const artifactPath = join(reportDir, fileName);
|
|
115
|
+
try {
|
|
116
|
+
const stats = statSync(artifactPath);
|
|
117
|
+
if (sinceMs !== undefined && stats.mtimeMs < sinceMs - 1000) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const artifact = JSON.parse(readFileSync(artifactPath, "utf8"));
|
|
121
|
+
if (!isSuiteSummaryArtifact(artifact)) {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (sinceMs !== undefined && artifact.createdAtMs < sinceMs - 1000) {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
suites.push(artifact.suite);
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return suites.sort((leftSuite, rightSuite) => leftSuite.name.localeCompare(rightSuite.name));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Project the live in-memory {@link SuiteState} down to the serializable
|
|
137
|
+
* {@link SuiteSummary} that gets written to disk. Drops anything that can't or
|
|
138
|
+
* shouldn't cross the process boundary (clients, tracers, raw Error objects).
|
|
139
|
+
*/
|
|
140
|
+
function createSuiteSummary(suite) {
|
|
141
|
+
return {
|
|
142
|
+
name: suite.name,
|
|
143
|
+
trackingDisabled: suite.trackingDisabled,
|
|
144
|
+
trackingDisabledReason: suite.trackingDisabledReason,
|
|
145
|
+
setupError: suite.setupError
|
|
146
|
+
? { message: suite.setupError.message }
|
|
147
|
+
: undefined,
|
|
148
|
+
uploadFailureCount: suite.uploadFailureCount,
|
|
149
|
+
results: suite.results.map(createTestResultSummary),
|
|
150
|
+
acceptanceResults: suite.acceptanceResults,
|
|
151
|
+
links: suite.links.map(({ label, url }) => ({ label, url })),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function createTestResultSummary(result) {
|
|
155
|
+
return {
|
|
156
|
+
suiteName: result.suiteName,
|
|
157
|
+
testName: result.testName,
|
|
158
|
+
status: result.status,
|
|
159
|
+
output: toJsonSafeValue(result.output),
|
|
160
|
+
annotations: result.annotations.map(({ name, score, label, explanation, annotatorKind, metadata, traceId, }) => ({
|
|
161
|
+
name,
|
|
162
|
+
score,
|
|
163
|
+
label,
|
|
164
|
+
explanation,
|
|
165
|
+
annotatorKind,
|
|
166
|
+
metadata,
|
|
167
|
+
traceId,
|
|
168
|
+
})),
|
|
169
|
+
error: result.error,
|
|
170
|
+
durationMs: result.durationMs,
|
|
171
|
+
repetitionNumber: result.repetitionNumber,
|
|
172
|
+
repetitions: result.repetitions,
|
|
173
|
+
dryRun: result.dryRun,
|
|
174
|
+
traceId: result.traceId,
|
|
175
|
+
runId: result.runId,
|
|
176
|
+
exampleId: result.exampleId,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Make a recorded test output safe to JSON-serialize: `bigint` values are
|
|
181
|
+
* stringified, and anything that still can't be serialized (cycles, etc.)
|
|
182
|
+
* falls back to its `String()` form rather than throwing.
|
|
183
|
+
*/
|
|
184
|
+
function toJsonSafeValue(value) {
|
|
185
|
+
if (value === undefined) {
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
return JSON.parse(JSON.stringify(value, (_key, nestedValue) => typeof nestedValue === "bigint" ? nestedValue.toString() : nestedValue));
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
return String(value);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Validate a parsed artifact before trusting it. Guards against version skew
|
|
197
|
+
* and partially-written or unrelated JSON files in the report directory.
|
|
198
|
+
*/
|
|
199
|
+
function isSuiteSummaryArtifact(value) {
|
|
200
|
+
if (!isRecord(value)) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
const suite = value.suite;
|
|
204
|
+
return (value.version === ARTIFACT_VERSION &&
|
|
205
|
+
typeof value.createdAtMs === "number" &&
|
|
206
|
+
isRecord(suite) &&
|
|
207
|
+
typeof suite.name === "string" &&
|
|
208
|
+
Array.isArray(suite.results) &&
|
|
209
|
+
Array.isArray(suite.links));
|
|
210
|
+
}
|
|
211
|
+
function isArtifactFileName(fileName) {
|
|
212
|
+
return (fileName.startsWith(ARTIFACT_FILE_PREFIX) &&
|
|
213
|
+
(fileName.endsWith(".json") || fileName.endsWith(".json.tmp")));
|
|
214
|
+
}
|
|
215
|
+
function isRecord(value) {
|
|
216
|
+
return typeof value === "object" && value !== null;
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=report-artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-artifacts.js","sourceRoot":"","sources":["../../../src/testing/report-artifacts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,UAAU,EACV,MAAM,EACN,QAAQ,EACR,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,E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C,KAAK,EAAE,CAAC,IAAI,EAAE,WAAoB,EAAE,EAAE,CACnD,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,WAAW,CACvE,CACF,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,sBAAsB,CAAC,KAAc;IAC5C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1B,OAAO,CACL,KAAK,CAAC,OAAO,KAAK,gBAAgB;QAClC,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ;QACrC,QAAQ,CAAC,KAAK,CAAC;QACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;QAC5B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAC3B,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAgB;IAC1C,OAAO,CACL,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC;QACzC,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAC/D,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared "print the Phoenix summary once per run" policy for the jest and
|
|
3
|
+
* vitest reporters. The two frameworks differ only in which lifecycle methods
|
|
4
|
+
* they call; both delegate to {@link begin} on run start and {@link finish}
|
|
5
|
+
* on run end.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SuiteSummaryReportRun {
|
|
8
|
+
private hasPrinted;
|
|
9
|
+
private runStartedAtMs;
|
|
10
|
+
/**
|
|
11
|
+
* Reset state at the start of a run so suites/artifacts from a previous
|
|
12
|
+
* watch-mode invocation don't leak forward.
|
|
13
|
+
*/
|
|
14
|
+
begin(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Print the Phoenix summary once. Prefers the on-disk artifacts written by
|
|
17
|
+
* suite workers, falling back to the in-process registry. A no-op once the
|
|
18
|
+
* summary has already been printed for this run.
|
|
19
|
+
*/
|
|
20
|
+
finish(): void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=report-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-run.d.ts","sourceRoot":"","sources":["../../../src/testing/report-run.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,cAAc,CAAK;IAE3B;;;OAGG;IACH,KAAK,IAAI,IAAI;IAOb;;;;OAIG;IACH,MAAM,IAAI,IAAI;CAUf"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { clearSuiteSummaryArtifacts, readSuiteSummaryArtifacts, } from "./report-artifacts.js";
|
|
2
|
+
import { printSuiteSummaries } from "./reporter-format.js";
|
|
3
|
+
import { clearAllSuites, getAllSuites } from "./runner.js";
|
|
4
|
+
/**
|
|
5
|
+
* Shared "print the Phoenix summary once per run" policy for the jest and
|
|
6
|
+
* vitest reporters. The two frameworks differ only in which lifecycle methods
|
|
7
|
+
* they call; both delegate to {@link begin} on run start and {@link finish}
|
|
8
|
+
* on run end.
|
|
9
|
+
*/
|
|
10
|
+
export class SuiteSummaryReportRun {
|
|
11
|
+
hasPrinted = false;
|
|
12
|
+
runStartedAtMs = 0;
|
|
13
|
+
/**
|
|
14
|
+
* Reset state at the start of a run so suites/artifacts from a previous
|
|
15
|
+
* watch-mode invocation don't leak forward.
|
|
16
|
+
*/
|
|
17
|
+
begin() {
|
|
18
|
+
this.hasPrinted = false;
|
|
19
|
+
this.runStartedAtMs = Date.now();
|
|
20
|
+
clearAllSuites();
|
|
21
|
+
clearSuiteSummaryArtifacts();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Print the Phoenix summary once. Prefers the on-disk artifacts written by
|
|
25
|
+
* suite workers, falling back to the in-process registry. A no-op once the
|
|
26
|
+
* summary has already been printed for this run.
|
|
27
|
+
*/
|
|
28
|
+
finish() {
|
|
29
|
+
if (this.hasPrinted)
|
|
30
|
+
return;
|
|
31
|
+
const artifactSuites = readSuiteSummaryArtifacts({
|
|
32
|
+
sinceMs: this.runStartedAtMs,
|
|
33
|
+
});
|
|
34
|
+
const suites = artifactSuites.length > 0 ? artifactSuites : getAllSuites();
|
|
35
|
+
if (suites.length === 0)
|
|
36
|
+
return;
|
|
37
|
+
this.hasPrinted = true;
|
|
38
|
+
printSuiteSummaries(suites);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=report-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-run.js","sourceRoot":"","sources":["../../../src/testing/report-run.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;GAKG;AACH,MAAM,OAAO,qBAAqB;IACxB,UAAU,GAAG,KAAK,CAAC;IACnB,cAAc,GAAG,CAAC,CAAC;IAE3B;;;OAGG;IACH,KAAK;QACH,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACjC,cAAc,EAAE,CAAC;QACjB,0BAA0B,EAAE,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,MAAM;QACJ,IAAI,IAAI,CAAC,UAAU;YAAE,OAAO;QAC5B,MAAM,cAAc,GAAG,yBAAyB,CAAC;YAC/C,OAAO,EAAE,IAAI,CAAC,cAAc;SAC7B,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;QAC3E,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAChC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { TestResult } from "./state.js";
|
|
2
|
+
import type { AcceptanceResult } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* The serializable summary of one suite that the reporter renders. This is the
|
|
5
|
+
* payload written to and read from the artifact files in `report-artifacts.ts`,
|
|
6
|
+
* so it holds only plain data — no clients, tracers, or live state.
|
|
7
|
+
*/
|
|
8
|
+
export interface SuiteSummary {
|
|
9
|
+
/** Suite name (also the dataset / experiment name in Phoenix). */
|
|
10
|
+
name: string;
|
|
11
|
+
/** True when the suite did not sync to Phoenix (dry run, disabled, or error). */
|
|
12
|
+
trackingDisabled?: boolean;
|
|
13
|
+
/** Human-readable reason tracking was disabled, when known. */
|
|
14
|
+
trackingDisabledReason?: string;
|
|
15
|
+
/** Setup failure that disabled tracking, reduced to its message for printing. */
|
|
16
|
+
setupError?: {
|
|
17
|
+
message: string;
|
|
18
|
+
};
|
|
19
|
+
/** Number of best-effort uploads (runs + annotations) that failed. */
|
|
20
|
+
uploadFailureCount?: number;
|
|
21
|
+
/** Per-test outcomes shown in the summary. */
|
|
22
|
+
results: TestResult[];
|
|
23
|
+
/** Aggregate acceptance results shown in the summary. */
|
|
24
|
+
acceptanceResults?: AcceptanceResult[];
|
|
25
|
+
/** Phoenix UI links (dataset / experiment) printed at the end of the block. */
|
|
26
|
+
links: Array<{
|
|
27
|
+
label: string;
|
|
28
|
+
url: string;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Options that control how the reporter renders. Resolved once per run from the
|
|
33
|
+
* environment and the output stream (see {@link resolveRenderOptions}) and then
|
|
34
|
+
* threaded through every formatting function so jest and vitest behave
|
|
35
|
+
* identically without either reporter class needing options of its own.
|
|
36
|
+
*/
|
|
37
|
+
export interface RenderOptions {
|
|
38
|
+
/** Show every test row plus the legacy per-test `output:` detail block. */
|
|
39
|
+
verbose: boolean;
|
|
40
|
+
/** Emit ANSI color escapes. */
|
|
41
|
+
color: boolean;
|
|
42
|
+
/** Max test rows shown per suite in compact mode (failures are never hidden). */
|
|
43
|
+
maxRows: number;
|
|
44
|
+
/** Terminal width budget used to size tables. */
|
|
45
|
+
maxWidth: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Resolve {@link RenderOptions} from the environment and output stream.
|
|
49
|
+
*
|
|
50
|
+
* Verbosity: `PHOENIX_TEST_REPORTER=verbose` (or the `PHOENIX_TEST_VERBOSE=1`
|
|
51
|
+
* alias) restores the full per-test dump; the default is the compact view.
|
|
52
|
+
* `PHOENIX_TEST_REPORTER_MAX_ROWS` caps the per-suite rows (default 10).
|
|
53
|
+
*
|
|
54
|
+
* Color follows the common ecosystem rules: off when `NO_COLOR` is set, in CI,
|
|
55
|
+
* on a non-TTY, or a "dumb" terminal; `PHOENIX_TEST_COLOR` / `FORCE_COLOR`
|
|
56
|
+
* force it on or off.
|
|
57
|
+
*/
|
|
58
|
+
export declare function resolveRenderOptions(env?: NodeJS.ProcessEnv, stream?: {
|
|
59
|
+
isTTY?: boolean;
|
|
60
|
+
columns?: number;
|
|
61
|
+
}): RenderOptions;
|
|
62
|
+
/**
|
|
63
|
+
* Render a single suite. A clean suite collapses to one line; a suite with
|
|
64
|
+
* failures or misses expands into a per-row diagnosis (scores, rationale,
|
|
65
|
+
* output, and the Phoenix ids needed to pull the trace). Pass a verbose
|
|
66
|
+
* {@link RenderOptions} to restore the full per-test dump.
|
|
67
|
+
*/
|
|
68
|
+
export declare function formatSuiteSummary(suite: SuiteSummary, o?: RenderOptions): string;
|
|
69
|
+
/**
|
|
70
|
+
* Render the run header (totals + tracking note) and, for multi-suite runs, an
|
|
71
|
+
* aligned overview table: one row per suite with its pass count, primary metric,
|
|
72
|
+
* acceptance verdict, mean latency, and a miss/fail note. This is the index;
|
|
73
|
+
* only suites with problems are expanded into a detail block below it.
|
|
74
|
+
*/
|
|
75
|
+
export declare function formatScoreboard(suites: readonly SuiteSummary[], o?: RenderOptions): string;
|
|
76
|
+
/**
|
|
77
|
+
* Print the run summary: the overview header (and, for multi-suite runs, the
|
|
78
|
+
* index table), then an expanded detail block for every suite that failed or
|
|
79
|
+
* had misses. Clean suites are fully described by their overview row. A
|
|
80
|
+
* single-suite run always prints its block; verbose prints every block.
|
|
81
|
+
*/
|
|
82
|
+
export declare function printSuiteSummaries(suites: readonly SuiteSummary[]): void;
|
|
83
|
+
//# sourceMappingURL=reporter-format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter-format.d.ts","sourceRoot":"","sources":["../../../src/testing/reporter-format.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EACV,gBAAgB,EAGjB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,+DAA+D;IAC/D,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iFAAiF;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