rename to attachmentIndices

This commit is contained in:
Simon Knott 2024-12-20 13:03:38 +01:00
parent 4fe6927c5d
commit 9039219e47
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -32,7 +32,7 @@ import { testInfoError } from './util';
export interface TestStepInternal { export interface TestStepInternal {
complete(result: { error?: Error | unknown, suggestedRebaseline?: string }): void; complete(result: { error?: Error | unknown, suggestedRebaseline?: string }): void;
attachmentIndexes: number[]; attachmentIndices: number[];
stepId: string; stepId: string;
title: string; title: string;
category: 'hook' | 'fixture' | 'test.step' | 'expect' | 'attach' | string; category: 'hook' | 'fixture' | 'test.step' | 'expect' | 'attach' | string;
@ -249,7 +249,7 @@ export class TestInfoImpl implements TestInfo {
return zones.zoneData<ExpectZone>('expectZone')?.stepId; return zones.zoneData<ExpectZone>('expectZone')?.stepId;
} }
_addStep(data: Omit<TestStepInternal, 'complete' | 'stepId' | 'steps' | 'attachmentIndexes'>, parentStep?: TestStepInternal): TestStepInternal { _addStep(data: Omit<TestStepInternal, 'complete' | 'stepId' | 'steps' | 'attachmentIndices'>, parentStep?: TestStepInternal): TestStepInternal {
const stepId = `${data.category}@${++this._lastStepId}`; const stepId = `${data.category}@${++this._lastStepId}`;
if (data.isStage) { if (data.isStage) {
@ -268,12 +268,12 @@ export class TestInfoImpl implements TestInfo {
} }
data.location = data.location || filteredStack[0]; data.location = data.location || filteredStack[0];
const attachmentIndexes: number[] = []; const attachmentIndices: number[] = [];
const step: TestStepInternal = { const step: TestStepInternal = {
stepId, stepId,
...data, ...data,
steps: [], steps: [],
attachmentIndexes, attachmentIndices,
complete: result => { complete: result => {
if (step.endWallTime) if (step.endWallTime)
return; return;
@ -310,7 +310,7 @@ export class TestInfoImpl implements TestInfo {
}; };
this._onStepEnd(payload); this._onStepEnd(payload);
const errorForTrace = step.error ? { name: '', message: step.error.message || '', stack: step.error.stack } : undefined; const errorForTrace = step.error ? { name: '', message: step.error.message || '', stack: step.error.stack } : undefined;
const attachments = attachmentIndexes.map(i => this.attachments[i]); const attachments = attachmentIndices.map(i => this.attachments[i]);
this._tracing.appendAfterActionForStep(stepId, errorForTrace, attachments); this._tracing.appendAfterActionForStep(stepId, errorForTrace, attachments);
} }
}; };
@ -422,7 +422,7 @@ export class TestInfoImpl implements TestInfo {
private _attach(attachment: TestInfo['attachments'][0], stepId: string | undefined) { private _attach(attachment: TestInfo['attachments'][0], stepId: string | undefined) {
const index = this._attachmentsPush(attachment) - 1; const index = this._attachmentsPush(attachment) - 1;
if (stepId) if (stepId)
this._stepMap.get(stepId)!.attachmentIndexes.push(index); this._stepMap.get(stepId)!.attachmentIndices.push(index);
this._onAttach({ this._onAttach({
testId: this.testId, testId: this.testId,
name: attachment.name, name: attachment.name,