{"action":"created","issue":{"url":"https://api.github.com/repos/avajs/ava/issues/32","repository_url":"https://api.github.com/repos/avajs/ava","labels_url":"https://api.github.com/repos/avajs/ava/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/avajs/ava/issues/32/comments","events_url":"https://api.github.com/repos/avajs/ava/issues/32/events","html_url":"https://github.com/avajs/ava/issues/32","id":104298417,"number":32,"title":"Should `process.cwd()` be changed to the directory of the currently running test?","user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/avajs/ava/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/avajs/ava/labels/help%20wanted","name":"help wanted","color":"159818"},{"url":"https://api.github.com/repos/avajs/ava/labels/priority","name":"priority","color":"fbca04"},{"url":"https://api.github.com/repos/avajs/ava/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2015-09-01T16:01:44Z","updated_at":"2016-05-22T17:57:04Z","closed_at":null,"body":"Currently the cwd is the directory you execute `ava` in, but `ava` can be executed from any upper level in the project and will search down for test files, so the cwd is pretty arbitrary and useless. I want to make the cwd actually useful.\r\n\r\nThere are two options:\r\n\r\n1.  Change cwd to root of the project. (This is what gulp/grunt does)\r\n2.  Change cwd to the directory of the currently running test file. (This is what I personally prefer)\r\n\r\nThe reason I prefer the latter is that we *run* the test files hence IMHO the cwd is where we run it. It's like we would do: `cd tests && node test.js`.\r\n\r\n-\r\n\r\nCurrently you have to do this to be able to load a read a test relative file:\r\n\r\n```js\r\nvar path = require('path');\r\nvar fs = require('fs');\r\nfs.readFileSync(path.join(__dirname, 'foo.json'));\r\n```\r\n\r\nIf we changed `process.cwd()` to the currently running test directory we could instead just do:\r\n\r\n```js\r\nvar fs = require('fs');\r\nfs.readFileSync('foo.json');\r\n```\r\n\r\n-\r\n\r\nThoughts? Anything I'm missing?"},"comment":{"url":"https://api.github.com/repos/avajs/ava/issues/comments/220846264","html_url":"https://github.com/avajs/ava/issues/32#issuecomment-220846264","issue_url":"https://api.github.com/repos/avajs/ava/issues/32","id":220846264,"user":{"login":"jamestalmage","id":4082216,"avatar_url":"https://avatars.githubusercontent.com/u/4082216?v=3","gravatar_id":"","url":"https://api.github.com/users/jamestalmage","html_url":"https://github.com/jamestalmage","followers_url":"https://api.github.com/users/jamestalmage/followers","following_url":"https://api.github.com/users/jamestalmage/following{/other_user}","gists_url":"https://api.github.com/users/jamestalmage/gists{/gist_id}","starred_url":"https://api.github.com/users/jamestalmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamestalmage/subscriptions","organizations_url":"https://api.github.com/users/jamestalmage/orgs","repos_url":"https://api.github.com/users/jamestalmage/repos","events_url":"https://api.github.com/users/jamestalmage/events{/privacy}","received_events_url":"https://api.github.com/users/jamestalmage/received_events","type":"User","site_admin":false},"created_at":"2016-05-22T17:57:04Z","updated_at":"2016-05-22T17:57:04Z","body":"We could add a `cwd` config option to `package.json`\r\n"}}
{"actor":{"display_login":"jamestalmage"}}