Skip to content

supportFile does not work for symlinked paths #3482

@ben8p

Description

@ben8p

Current behavior:

When supportFile is pointing to a symlinked path we get the error "Your supportFile is set to /whatever/support/index.js/index.js"
Where the "index.js" is repeated

Desired behavior:

supportFile should support symlinked paths

Steps to reproduce: (app code and test code)

  • Create the structure "foo/support/index.js"
  • Create the a symlink "bar" linking to "foo"
  • Set cypress supportFile configuration to "bar/support/index.js"
  • Observe the error

Versions

Cypress 3.1.5
Node 11.6.0
Linux Ubuntu 18.04

Additional info

The cause of the problem is

obj.supportFile = path.join(sf, path.basename(obj.supportFile))

It assume sf is a path and does not contain the filename.

But that is incorrect. sf is resolved to the full path, including index.js.

The line should probably become obj.supportFile = path.join(path.dirname(sf), path.basename(obj.supportFile))

Metadata

Metadata

Assignees

No one assigned

    Labels

    pkg/serverThis is due to an issue in the packages/server directorystage: ready for workThe issue is reproducible and in scopestaleno activity on this issue for a long periodtype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions