Skip to content

Commit 4a651ec

Browse files
committed
fix(service): Gate the devtools-artifacts manifest behind an emitArtifactsManifest
option (default off)
1 parent c46be98 commit 4a651ec

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎packages/service/src/index.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ export default class DevToolsHookService implements Services.ServiceInstance {
132132
#currentStepUid?: string
133133
/** Per-scenario step counter for stable, collision-free step uids. */
134134
#currentStepIndex = 0
135+
/** True when @wdio/allure-reporter is in the WDIO config (detected in
136+
* beforeSession) — auto-enables the artifacts manifest even if the option
137+
* isn't set, since session/spec-scoped Allure attach reads it. */
138+
#allureReporterConfigured = false
135139

136140
/** Wall-clock ms at the current test's start, set in beforeTest/beforeScenario;
137141
* the lower bound of that test's video frame window (per-test slicing). */
@@ -266,7 +270,8 @@ export default class DevToolsHookService implements Services.ServiceInstance {
266270
resolveOutputDir: () => this.#outputDir,
267271
prepareSnapshots: dedupeSnapshotsByTimestamp,
268272
log: (level, msg) => log[level](msg),
269-
emitManifest: true,
273+
emitManifest:
274+
this.#options.emitArtifactsManifest ?? this.#allureReporterConfigured,
270275
collectedArtifacts: this.#artifacts,
271276
onArtifact: (a) => this.#artifacts.push(a)
272277
}
@@ -389,6 +394,12 @@ export default class DevToolsHookService implements Services.ServiceInstance {
389394
}
390395

391396
if ('reporters' in config) {
397+
// Detect the Allure reporter (before we append our own) so the artifacts
398+
// manifest auto-enables for session/spec-scoped Allure attach.
399+
this.#allureReporterConfigured = (config.reporters || []).some((r) => {
400+
const name = Array.isArray(r) ? r[0] : r
401+
return typeof name === 'string' && name.includes('allure')
402+
})
392403
const self = this
393404
config.reporters = [
394405
...(config.reporters || []),

‎packages/service/src/types.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ export interface ServiceOptions extends BaseDevToolsOptions {
5353
* attached inline to Allure. `off` (default) or a retention policy. Trace
5454
* mode + `traceGranularity: 'test'` only. WDIO-service-specific for now. */
5555
video?: TraceVideoPolicy
56+
/** Write the `devtools-artifacts-<sessionId>.json` manifest next to the trace
57+
* — the generic index reporters/CI consume to discover produced artifacts.
58+
* Off by default (WDIO auto-attaches per-test traces to Allure directly);
59+
* auto-enabled when `@wdio/allure-reporter` is in the config, since
60+
* session/spec-scoped Allure attach reads the manifest. */
61+
emitArtifactsManifest?: boolean
5662
/**
5763
* capabilities used to launch the devtools application
5864
* @default

0 commit comments

Comments
 (0)