Issue
When truffle-config is initialized without a working directory specified, it seems that it searches for a truffle project root starting at process.cwd and checking each parent directory until it hits the root directory. If it finds a file called truffle.js in the directory it is searching it uses that as the project root (aka Config.working_directory). This path is then used as the base path for the build, contracts, and test directories.
The problem is that some projects, such as [zeppelin-solidity](https://github.com/openzeppelin/zeppelin-solidity], have opted to use truffle-config.js instead of truffle.js. If you then have a truffle.js file in a directory above your project root, that parent directory is incorrectly used as Config.working_directory, instead.
Steps to Reproduce
cd to the root directory of any truffle project
- If your truffle project uses
truffle.js as its config, rename this file to truffle-config.js.
- Run
cp truffle-config.js ../truffle.js to create a truffle.js file one level above your project root.
- Run
truffle test
Expected Behavior
Tests would run as per usual.
Also in the case when truffle decides not to use process.cwd as the project root, it should print some warning message to indicate that this is the case. Otherwise if nested truffle projects are used, it's possible that truffle commands ran in a child project will actually run against the parent project.
Actual Results
As of truffle v4.1.0:
TypeError: Cannot read property 'filter' of undefined
at truffle-core/lib/commands/test.js:47:1
at truffle-core/~/node-dir/lib/paths.js:72:1
at FSReqWrap.oncomplete (fs.js:166:21)
Environment
- Operating System: OS X
- Truffle version (
truffle version): v4.1.0 (also tested on v4.0.1)