Skip to content

Commit 57f811e

Browse files
committed
fix: use indexOf instead of lastIndexOf in inferArtifactBaseDir
Artifact paths stored in execution-state.json are relative to the repository root. When a task runs inside a worktree, the execution state file is nested at [worktree]/.spec2flow/runtime/platform-workers/[runId]/[taskId]/execution-state.json. Using lastIndexOf('/.spec2flow/') returns the worktree root as the base dir, so resolving repo-root-relative artifact paths against it produces doubled paths like [worktree]/.spec2flow/runtime/worktrees/[runId]/.spec2flow/... Using indexOf('/.spec2flow/') returns the actual repo root (before any .spec2flow/ occurrence), so artifact paths resolve correctly.
1 parent 55cbbbd commit 57f811e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/cli/src/platform/platform-worker-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ function inferArtifactBaseDir(statePath: string): string {
806806
const resolvedStatePath = path.resolve(statePath);
807807
const stateDir = path.dirname(resolvedStatePath);
808808
const nestedSpec2flowMarker = `${path.sep}.spec2flow${path.sep}`;
809-
const nestedSpec2flowIndex = stateDir.lastIndexOf(nestedSpec2flowMarker);
809+
const nestedSpec2flowIndex = stateDir.indexOf(nestedSpec2flowMarker);
810810

811811
if (nestedSpec2flowIndex >= 0) {
812812
return stateDir.slice(0, nestedSpec2flowIndex) || path.sep;

0 commit comments

Comments
 (0)