Page MenuHomePhabricator

`arc unit` should automatically cd to the root of the project
Open, LowPublic

Description

I've noticed that if I run arc unit from a subdirectory, that directory becomes the working directory of the unit test engine.

Use case: I have a binary whose path is defined via .arcconfig. It may be in $PATH, but it may also be resolved relative to the project root (e.g. xunit vs path/to/xunit.) The latter doesn't work reliably, due to this issue.

I can work around it, of course, but I'd like to ask if there's any reason not to cd to the root? For context, git cds to the root before executing subcommands, and that behavior tends to help by providing a more consistent environment to aliases and any executable parameters.

Event Timeline

staticshock raised the priority of this task from to Needs Triage.
staticshock updated the task description. (Show Details)
staticshock added a project: Arcanist.
staticshock added a subscriber: staticshock.

Additionally, $this->getPaths() returns paths relative to the root of the project, which don't actually resolve if arc unit is run from anywhere else.

In this particular case it seems like the issue is that the relative path in the .arcconfig file isn't resolved relative to the repository root. There would be another use case in which running the external test engine from a different subdirectory doesn't behave in the same way that it would when run from the repository root.

IIRC, the configuration specified in .arcconfig doesn't have any concept of type (to be able to differentiate "this is a path" from "this is a string").

T5568 should fix this (from memory, T2039 fixed this for linters).

joshuaspence triaged this task as Low priority.Jan 11 2015, 9:25 PM