Skip to content

v2-run needs a way to use package directory #6178

Closed
@symbiont-sam-halliday

Description

@symbiont-sam-halliday

Describe the bug

v2-run tasty uses the current working directory when invoking the tasty binary, but this breaks multi-package builds (i.e. projects with a cabal.project) that have test data in a specific location relative to the .cabal file.

For example, aeson-golden tests will fail because they expect to be run from the package directory, not the location of the cabal.project file.

To Reproduce
Steps to reproduce the behavior:

$ cd foo
$ cabal v2-run tasty

vs

$ cd ..
$ cabal v2-run foo:tasty

Expected behavior

The tests should run with the CWD set to the directory containing the .cabal file.

System information

  • Operating system: N/A
  • cabal, ghc versions: all released versions

** Other Context

Not only does this mean that running tests from the root dir vs the package dir produce different results, but stack uses the convention of always running tests from the dir containing the .cabal file and therefore this subtle change in behaviour makes it difficult to migrate from stack to cabal or for developers to have a choice of build tool on their project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions