Skip to content

test(taskctl): pipeline.test.ts uses hardcoded /tmp path — switch to tmpdir() fixture #221

@randomm

Description

@randomm

Problem

packages/opencode/test/tasks/pipeline.test.ts (added in Phase 3b) uses a hardcoded temp directory path in beforeEach:

const testDir = `/tmp/taskctl-pipeline-test-${Date.now()}-${Math.random()}`

While the Date.now()/Math.random() suffix prevents the worst collisions, the correct pattern for this repo is to use the tmpdir() fixture from test/fixture/fixture.ts, which provides:

  • Automatic cleanup via await using
  • Realpath resolution
  • Null-byte sanitization (CI safety)
  • Consistent patterns with all other test files

Fix

Replace the manual temp dir construction in beforeEach with the tmpdir() fixture pattern used in store.test.ts, scheduler.test.ts, etc:

import { tmpdir } from "../fixture/fixture"

// In each test:
test("example", async () => {
  await using tmp = await tmpdir()
  await Instance.provide({ directory: tmp.path, fn: async () => {
    // test body
  }})
})

Acceptance criteria

  • pipeline.test.ts uses tmpdir() fixture pattern
  • No hardcoded /tmp paths remain
  • All tests still pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions