Skip to content

Tests fail when using @/ path aliases instead of relative module imports #1618

@ankormoreankor

Description

@ankormoreankor

Tests fail when components use @/ path alias imports instead of module-specific imports (e.g., @components/Link).

Steps to reproduce:

  1. Open any test, for instance Alert.test.tsx.
  2. Open any component imported in this test's execution path. For example, AlertLink is imported via packages/ui/src/components/alert/index.ts, which is then imported in Alert.test.tsx.
  3. Change the import pattern in the component from a module-specific import like '@components/Link' to a root alias import like '@/components'.

The test will fail with the error shown in the screenshot. This appears to happen because @/components pulls in dependencies from the yaml-editor package, expanding the test's execution context beyond what's expected or properly mocked in the test environment.

Image

Additional context:
This suggests our test environment isn't properly resolving or isolating @/ path aliases, causing unintended dependencies to be included in the test context.

Possible solution:
Either update our test configuration to properly handle @/ path aliases or continue using module-specific imports like @components/Link in components that may be subject to testing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions