← All work

Testing · mastra-ai/mastra

Test filesystem helpers and expand source-file recognition

Adds Vitest coverage for eight filesystem utilities shared by LocalFilesystem and LocalSkillSource. Also extends MIME mappings and text-file classification for 14 source and configuration file extensions.

The problem

The shared filesystem helpers lacked unit coverage for path handling, error classification, file-type detection, and filesystem metadata. Their MIME and text-extension tables also omitted formats including Svelte, MDX, Kotlin, and Terraform files.

The approach

Adds tests for tilde expansion, path resolution, ENOENT/EEXIST detection, MIME lookup, and text-file classification, including edge cases and fallback behavior. Tests for fsExists and fsStat use real temporary directories created and removed per test, checking existence, metadata, and missing-file errors without mocks. Extends both classification tables with 14 extensions while leaving exported signatures unchanged.

What changed

The new test suite exercises all eight helpers, including FileNotFoundError behavior and directory metadata. The helpers now recognize the added extensions as text and return their configured MIME types; despite the description's test-only framing, the diff also changes file-classification behavior.

  • typescript
  • vitest
  • filesystem
  • unit-tests
  • mime-types
  • path-resolution