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 {
complete(result: { error?: Error | unknown, suggestedRebaseline?: string }): void;
attachmentIndexes: number[];
attachmentIndices: number[];
stepId: string;
title: string;
category: 'hook' | 'fixture' | 'test.step' | 'expect' | 'attach' | string;
@ -249,7 +249,7 @@ export class TestInfoImpl implements TestInfo {
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}`;
if (data.isStage) {
@ -268,12 +268,12 @@ export class TestInfoImpl implements TestInfo {
}
data.location = data.location || filteredStack[0];
const attachmentIndexes: number[] = [];
const attachmentIndices: number[] = [];
const step: TestStepInternal = {
stepId,
...data,
steps: [],
attachmentIndexes,
attachmentIndices,
complete: result => {
if (step.endWallTime)
return;
@ -310,7 +310,7 @@ export class TestInfoImpl implements TestInfo {
};
this._onStepEnd(payload);
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);
}
};
@ -422,7 +422,7 @@ export class TestInfoImpl implements TestInfo {
private _attach(attachment: TestInfo['attachments'][0], stepId: string | undefined) {
const index = this._attachmentsPush(attachment) - 1;
if (stepId)
this._stepMap.get(stepId)!.attachmentIndexes.push(index);
this._stepMap.get(stepId)!.attachmentIndices.push(index);
this._onAttach({
testId: this.testId,
name: attachment.name,