@mknrt/pd-cypress-reporter
v0.2.0
Published
Cypress reporter for PD Dashboard Launches
Maintainers
Readme
@mknrt/pd-cypress-reporter
Cypress reporter for PD Dashboard Launches. By default, it seals a redacted, importable ZIP recovery record and only publishes against an already-issued Dashboard reservation. It never creates, opens, finalizes, or repairs a Dashboard Run.
This is a fork of mmisty/cypress-allure-adapter at da8e78eca16a6346bb9e0767bab5a7c46f3f46a8. The upstream LICENSE is retained verbatim; this fork is Apache-2.0.
Installation
npm install --save-dev @mknrt/pd-cypress-reporterCypress setup
Register the reporter before any host after:spec cleanup so it can copy a video before a handler deletes passing videos:
const { defineConfig } = require('cypress');
const { configurePdReporter } = require('@mknrt/pd-cypress-reporter/plugins');
module.exports = defineConfig({
e2e: {
async setupNodeEvents(on, config) {
const reporter = await configurePdReporter(on, config);
on('after:spec', async (spec, results) => {
await reporter.afterSpec(spec, results);
if (results?.video && !results.tests.some(test => test.attempts.some(attempt => attempt.state === 'failed'))) {
await require('fs/promises').rm(results.video, { force: true });
}
});
return reporter.config;
},
},
});Import the support bridge once, before application support code:
import '@mknrt/pd-cypress-reporter/support';CI configuration
Dashboard supplies the reservation/binding token and frozen identity. The reporter reads these only in the Node plugin process:
PD_RESULTS_PUBLISH=true
PD_LAUNCHES_MODE=shadow|authoritative
PD_LAUNCHES_URL=https://pd-launches.example
PD_BINDING_TOKEN=…
CI_SERVER_URL=… CI_PROJECT_ID=… CI_PIPELINE_ID=… CI_JOB_ID=…
CI_NODE_INDEX=0 CI_JOB_RETRY=0 PD_PROCESS_ATTEMPT=0
PD_PROJECT_KEY=project-key PD_CORRELATION_ID=uuidv7PD_RUN_ID and PD_PIPELINE_EXECUTION_ID are metadata only; Dashboard derives authority from the binding token. A failed-test rerun is linked only through an explicitly supplied, redacted original_execution_id -> rerun_execution_id map.
PD_BINDING_TOKEN is deliberately removed from Cypress browser env. Never put it in cypress.config.js, Cypress.env, test code, URLs, logs, manifests, or artifacts.
Offline and failure behavior
Without the literal PD_RESULTS_PUBLISH=true, and always when PD_LAUNCHES_MODE=off, the reporter makes zero Dashboard HTTP requests. By default, it seals pd-results/<bundle-id>.zip (override with PD_RESULTS_DIR) with restricted permissions:
manifest.json
events.ndjson
assets/sha256/<sha256>
checksums.jsonSet PD_RESULTS_BUNDLE=false to publish without writing the local bundle directory or ZIP. This also removes local recovery when publication is unavailable or fails. Any other value, including an unset variable, preserves the bundle.
PD_PROJECT_KEY and PD_CORRELATION_ID are Node-only archive identity fields; they are never copied into Cypress browser env. With the local bundle enabled, every event enters events.ndjson before any publication attempt. Preflight/bind/event/artifact/redaction/storage errors produce a token-free warning and retain the ZIP when present; they do not alter Cypress or CI exit status. shadow publishes immutable evidence only; authoritative publishes normal reporter data.
The Dashboard Project admin imports the bundle; the reporter never calls a Run lifecycle or direct-reservation API.
