From cf90525a7f9c342566bebc62e00d469b15e840d7 Mon Sep 17 00:00:00 2001 From: Matthew Thomas <25988124+Ma11hewThomas@users.noreply.github.com> Date: Sat, 15 Aug 2026 14:51:42 +0100 Subject: [PATCH] Update ctrf dependency and CLI to 0.3.0 --- README.md | 4 +-- package-lock.json | 79 ++++++-------------------------------------- package.json | 4 +-- src/validate.test.ts | 40 ++++++++++++++++++++++ 4 files changed, 54 insertions(+), 73 deletions(-) diff --git a/README.md b/README.md index 6be4d96..746de0b 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ By standardizing test results, reports can be validated, merged, compared, and a Use `npx` to run the CLI without installing: ```bash -npx ctrf-cli@0.0.5 validate report.json +npx ctrf-cli@0.3.0 validate report.json ``` ### Global Installation @@ -32,7 +32,7 @@ npx ctrf-cli@0.0.5 validate report.json Or install globally for repeated use: ```bash [npm] -npm install -g ctrf-cli@0.0.5 +npm install -g ctrf-cli@0.3.0 ``` After global installation, use the `ctrf` command: diff --git a/package-lock.json b/package-lock.json index 4200805..4350075 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "ctrf-cli", - "version": "0.0.5", + "version": "0.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ctrf-cli", - "version": "0.0.5", + "version": "0.3.0", "license": "MIT", "dependencies": { - "ctrf": "0.2.1", + "ctrf": "0.3.0", "glob": "13.0.6", "yargs": "18.1.0" }, @@ -159,9 +159,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT OR Apache-2.0", "optional": true, "os": [ @@ -179,9 +176,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT OR Apache-2.0", "optional": true, "os": [ @@ -199,9 +193,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT OR Apache-2.0", "optional": true, "os": [ @@ -219,9 +210,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT OR Apache-2.0", "optional": true, "os": [ @@ -403,9 +391,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -423,9 +408,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -443,9 +425,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -463,9 +442,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -483,9 +459,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -503,9 +476,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1305,15 +1275,15 @@ "license": "MIT" }, "node_modules/ctrf": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/ctrf/-/ctrf-0.2.1.tgz", - "integrity": "sha512-iUo/eHcM5yG8aBS3Miqce9NNiZCtmVZxPpgmZEJIZ96bubwj7IpZx3IqsDqCH2FZjR71EH2NLtbBhtfzDjpaUg==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/ctrf/-/ctrf-0.3.0.tgz", + "integrity": "sha512-2luVgKCF/A/pgMKY54AUdicCNbU+Hy3Bl+xwcp98inASt/0fnoNC/A4Bwh/GO47cIuD5c7SS3MY/DY42dPf4zQ==", "license": "MIT", "dependencies": { "ajv": "8.20.0", "ajv-formats": "3.0.1", "glob": "13.0.6", - "yargs": "18.0.0" + "yargs": "18.1.0" }, "bin": { "ctrf": "dist/cli/cli.js" @@ -1322,23 +1292,6 @@ "node": ">=20.19.0" } }, - "node_modules/ctrf/node_modules/yargs": { - "version": "18.0.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-18.0.0.tgz", - "integrity": "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==", - "license": "MIT", - "dependencies": { - "cliui": "^9.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "string-width": "^7.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^22.0.0" - }, - "engines": { - "node": "^20.19.0 || ^22.12.0 || >=23" - } - }, "node_modules/detect-libc": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", @@ -1696,9 +1649,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -1720,9 +1670,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -1744,9 +1691,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -1768,9 +1712,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -1898,9 +1839,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.17", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.17.tgz", - "integrity": "sha512-xQLf0A3HOMlgHq0n247/LRuAOYmB7dXJ/DvAxGvsSBij45XtBSmQycu+F8ODbHwns/XyFZagyL1+J0Offw1E0g==", + "version": "3.3.18", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz", + "integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==", "dev": true, "funding": [ { diff --git a/package.json b/package.json index 9356f1a..4958193 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "type": "module", "name": "ctrf-cli", - "version": "0.0.5", + "version": "0.3.0", "description": "Various CTRF utilities available from the command line", "main": "dist/index.js", "bin": { @@ -54,7 +54,7 @@ "test-results" ], "dependencies": { - "ctrf": "0.2.1", + "ctrf": "0.3.0", "glob": "13.0.6", "yargs": "18.1.0" }, diff --git a/src/validate.test.ts b/src/validate.test.ts index 3387099..1b08edd 100644 --- a/src/validate.test.ts +++ b/src/validate.test.ts @@ -66,6 +66,46 @@ describe("validateReport", () => { expect(result.valid).toBe(true); }); + it("should validate current CTRF identity fields and labels", async () => { + const test = new TestBuilder() + .testId("authentication/login") + .executionId("execution-123") + .name("logs in") + .status("passed") + .duration(100) + .labels({ owners: ["qa", "platform"], priority: "high" }) + .build(); + + test.retryAttempts = [ + { attempt: 1, attemptId: "attempt-1", status: "failed", duration: 50 }, + ]; + test.attachments = [ + { + attachmentId: "attachment-1", + name: "trace", + contentType: "text/plain", + path: "trace.txt", + }, + ]; + + const currentReport = new ReportBuilder() + .runId("run-123") + .tool({ name: "test-tool" }) + .environment({ shardId: "shard-1-of-2" }) + .addTest(test) + .build(); + const currentReportPath = path.join(tmpDir, "current-report.json"); + fs.writeFileSync( + currentReportPath, + JSON.stringify(currentReport, null, 2), + ); + + await validateReport(currentReportPath, false); + + expect(exitSpy).toHaveBeenCalledWith(0); + expect(validate(currentReport).valid).toBe(true); + }); + it("should reject an invalid CTRF report", async () => { await validateReport(invalidReportPath, false); expect(exitSpy).toHaveBeenCalledWith(2);