Skip to content

Issue: ENAMETOOLONG during @angular/build:karma test builds on macOS #31968

@dr-bharada

Description

@dr-bharada

Command

test

Description

Hi team 👋,

I am encountering an ENAMETOOLONG error when running tests with the @angular/build:karma builder.
This happens because Angular generates extremely long output filenames for test source maps, which include the full absolute path of the component under test.

On macOS (and some CI environments), the filesystem limits paths to 255 characters, and the generated spec map paths exceed this limit.

Example error

Describe the solution you'd like

When the project structure is nested (common in enterprise monorepos), the combined absolute path of the repo + project + feature modules + filename becomes extremely long (300–390+ chars).

This makes the test runner fail with ENAMETOOLONG before execution even starts.

Impact

  • Test builds cannot run on macOS
  • CI pipelines fail
  • Refactoring large monorepos becomes extremely difficult
  • Developers must manually shorten folder structures even when logically correct

Suggested solutions

Option 1 — Shorten or hash test output paths

Emit something like:

Describe alternatives you've considered

instead of embedding the entire directory path.

Option 2 — Add a configuration flag (e.g. "shortPath": true)

Something like:

"test": {
  "builder": "@angular/build:karma",
  "options": {
    "shortPath": true
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions