testdossier 0.2.0 → 0.2.1
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 +7 -7
- package/lib/testdossier.mjs +15 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,18 +79,18 @@ delete the file to change it.
|
|
|
79
79
|
Before sending anything, inspect what the CLI detected:
|
|
80
80
|
|
|
81
81
|
```bash
|
|
82
|
-
npx --yes testdossier@0.2.
|
|
82
|
+
npx --yes testdossier@0.2.1 upload playwright-results.json --dry-run
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
## Supported reports
|
|
86
86
|
|
|
87
87
|
| Runner or format | Example |
|
|
88
88
|
|---|---|
|
|
89
|
-
| Playwright JSON | `npx --yes testdossier@0.2.
|
|
90
|
-
| Cypress JSON | `npx --yes testdossier@0.2.
|
|
91
|
-
| Cucumber JSON | `npx --yes testdossier@0.2.
|
|
92
|
-
| JUnit XML | `npx --yes testdossier@0.2.
|
|
93
|
-
| Generic JSON | `npx --yes testdossier@0.2.
|
|
89
|
+
| Playwright JSON | `npx --yes testdossier@0.2.1 upload playwright-results.json` |
|
|
90
|
+
| Cypress JSON | `npx --yes testdossier@0.2.1 upload cypress-results.json` |
|
|
91
|
+
| Cucumber JSON | `npx --yes testdossier@0.2.1 upload cucumber-results.json` |
|
|
92
|
+
| JUnit XML | `npx --yes testdossier@0.2.1 upload junit-results.xml` |
|
|
93
|
+
| Generic JSON | `npx --yes testdossier@0.2.1 upload testdossier-ci.json` |
|
|
94
94
|
|
|
95
95
|
Detection uses the report's contents, not its filename. If a custom reporter
|
|
96
96
|
creates an ambiguous shape, pass `--format playwright`, `--format cypress`,
|
|
@@ -150,7 +150,7 @@ Run `npx testdossier --help` for every option.
|
|
|
150
150
|
## Using the same flow in CI
|
|
151
151
|
|
|
152
152
|
Commit `testdossier.json` and set `TD_CI_TOKEN` in the provider's encrypted
|
|
153
|
-
secret storage; the pipeline step is then `npx --yes testdossier@0.2.
|
|
153
|
+
secret storage; the pipeline step is then `npx --yes testdossier@0.2.1` with
|
|
154
154
|
no arguments. Run identity, build, branch, and provider metadata are inferred
|
|
155
155
|
automatically on GitHub Actions, GitLab CI, Jenkins, Azure DevOps, Bitbucket
|
|
156
156
|
Pipelines, and CircleCI. The Access Tokens dialog still generates
|
package/lib/testdossier.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
2
2
|
import { readFile, stat, writeFile } from "node:fs/promises";
|
|
3
3
|
import { basename, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
4
4
|
|
|
5
|
-
export const VERSION = "0.2.
|
|
5
|
+
export const VERSION = "0.2.1";
|
|
6
6
|
const DEFAULT_ORIGIN = "https://testdossier.com";
|
|
7
7
|
const ENV_FILE_NAME = ".env.testdossier";
|
|
8
8
|
const CONFIG_FILE_NAME = "testdossier.json";
|
|
@@ -326,8 +326,8 @@ export function normalizeEndpoint(input = DEFAULT_ORIGIN) {
|
|
|
326
326
|
const path = url.pathname.replace(/\/+$/, "");
|
|
327
327
|
if (!path) {
|
|
328
328
|
url.pathname = "/api/ci/ingest";
|
|
329
|
-
} else if (path !== "/api/ci/ingest") {
|
|
330
|
-
throw new CliError("TestDossier URL must be an origin or end with /api/ci/ingest.");
|
|
329
|
+
} else if (path !== "/api/ci/ingest" && path !== "/api/v1/ci/ingest") {
|
|
330
|
+
throw new CliError("TestDossier URL must be an origin or end with /api/ci/ingest (or its /api/v1 alias).");
|
|
331
331
|
}
|
|
332
332
|
return url.toString();
|
|
333
333
|
}
|
|
@@ -766,7 +766,7 @@ Usage:
|
|
|
766
766
|
|
|
767
767
|
Options:
|
|
768
768
|
--format <format> auto (default), cypress, playwright, cucumber, junit, generic
|
|
769
|
-
--url <url> TestDossier origin or /api/ci/ingest
|
|
769
|
+
--url <url> TestDossier origin or ingest endpoint (/api/ci/ingest or /api/v1/ci/ingest)
|
|
770
770
|
--run-id <id> Stable idempotency key for this execution
|
|
771
771
|
--build <value> Commit, build number, or release identifier
|
|
772
772
|
--branch <value> Branch name
|
|
@@ -886,11 +886,19 @@ export async function runCli(
|
|
|
886
886
|
stderr,
|
|
887
887
|
action: "verify",
|
|
888
888
|
});
|
|
889
|
-
|
|
889
|
+
// A 200 alone is not proof: a mis-pointed URL can hit an HTML page,
|
|
890
|
+
// which the response parser degrades to {}. Only the ingest handler's
|
|
891
|
+
// explicit verify marker + project identity count as success.
|
|
892
|
+
if (!result || result.verify !== true || !result.project_id) {
|
|
893
|
+
throw new CliError(
|
|
894
|
+
`verify got a successful response from ${new URL(endpoint).origin} that is not the TestDossier ingest API — check the --url / TD_URL destination.`,
|
|
895
|
+
1,
|
|
896
|
+
);
|
|
897
|
+
}
|
|
898
|
+
const name = typeof result.project_name === "string" && result.project_name
|
|
890
899
|
? ` "${result.project_name}"`
|
|
891
900
|
: "";
|
|
892
|
-
|
|
893
|
-
stdout(`Token verified for project${name}${id} at ${new URL(endpoint).origin} — CI ingestion enabled.`);
|
|
901
|
+
stdout(`Token verified for project${name} (${result.project_id}) at ${new URL(endpoint).origin} — CI ingestion enabled.`);
|
|
894
902
|
return 0;
|
|
895
903
|
}
|
|
896
904
|
|