{"action":"created","issue":{"url":"https://api.github.com/repos/sindresorhus/ava/issues/544","repository_url":"https://api.github.com/repos/sindresorhus/ava","labels_url":"https://api.github.com/repos/sindresorhus/ava/issues/544/labels{/name}","comments_url":"https://api.github.com/repos/sindresorhus/ava/issues/544/comments","events_url":"https://api.github.com/repos/sindresorhus/ava/issues/544/events","html_url":"https://github.com/sindresorhus/ava/pull/544","id":132744168,"number":544,"title":"Only run tests for changed sources","user":{"login":"novemberborn","id":33538,"avatar_url":"https://avatars.githubusercontent.com/u/33538?v=3","gravatar_id":"","url":"https://api.github.com/users/novemberborn","html_url":"https://github.com/novemberborn","followers_url":"https://api.github.com/users/novemberborn/followers","following_url":"https://api.github.com/users/novemberborn/following{/other_user}","gists_url":"https://api.github.com/users/novemberborn/gists{/gist_id}","starred_url":"https://api.github.com/users/novemberborn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novemberborn/subscriptions","organizations_url":"https://api.github.com/users/novemberborn/orgs","repos_url":"https://api.github.com/users/novemberborn/repos","events_url":"https://api.github.com/users/novemberborn/events{/privacy}","received_events_url":"https://api.github.com/users/novemberborn/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":22,"created_at":"2016-02-10T16:15:08Z","updated_at":"2016-03-02T18:00:44Z","closed_at":"2016-03-01T19:27:02Z","pull_request":{"url":"https://api.github.com/repos/sindresorhus/ava/pulls/544","html_url":"https://github.com/sindresorhus/ava/pull/544","diff_url":"https://github.com/sindresorhus/ava/pull/544.diff","patch_url":"https://github.com/sindresorhus/ava/pull/544.patch"},"body":"Fixes #115, building on top of the `--watch` implementation.\r\n\r\nTest workers keep track of test dependencies for all registered file extensions. These are sent back to the Api as part of the 'teardown' event, ensuring they're captured irrespective of whether tests passed.\r\n\r\nThe watcher rejects any dependencies that are not source files, matching how Chokidar watches for source file modifications. It maintains a list of source dependencies for each test file.\r\n\r\nThe watcher will find the test files that depend on modified source files and rerun those (along with any other modified test files). If any modified source files cannot be mapped to test files all tests are rerun. This is necessary because only `require()` dependencies are tracked, not file access.\r\n\r\nRun `DEBUG=ava:watcher $(npm bin)/ava --watch` in a project to see the matching in action.\r\n\r\nThis required some extensive refactoring of the watcher code itself. Worth it in the end since the changes drop in quite nicely. This will conflict heavily with #536 so best if that lands first.\r\n\r\nAdditionally I found that test workers may receive multiple `teardown` events. This made the `emits dependencies for test files` Api test flaky since it would occur for uncaught exceptions. That's fixed in a separate commit."},"comment":{"url":"https://api.github.com/repos/sindresorhus/ava/issues/comments/191351215","html_url":"https://github.com/sindresorhus/ava/pull/544#issuecomment-191351215","issue_url":"https://api.github.com/repos/sindresorhus/ava/issues/544","id":191351215,"user":{"login":"novemberborn","id":33538,"avatar_url":"https://avatars.githubusercontent.com/u/33538?v=3","gravatar_id":"","url":"https://api.github.com/users/novemberborn","html_url":"https://github.com/novemberborn","followers_url":"https://api.github.com/users/novemberborn/followers","following_url":"https://api.github.com/users/novemberborn/following{/other_user}","gists_url":"https://api.github.com/users/novemberborn/gists{/gist_id}","starred_url":"https://api.github.com/users/novemberborn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novemberborn/subscriptions","organizations_url":"https://api.github.com/users/novemberborn/orgs","repos_url":"https://api.github.com/users/novemberborn/repos","events_url":"https://api.github.com/users/novemberborn/events{/privacy}","received_events_url":"https://api.github.com/users/novemberborn/received_events","type":"User","site_admin":false},"created_at":"2016-03-02T18:00:44Z","updated_at":"2016-03-02T18:00:44Z","body":"> Yup, that's true, since they don't call ._compile, but those are also rarely overriden, so a combination of ._compile + hooks for JSON/native could work.\r\n\r\nOh that sounds good. I considered extracting it initially but then figured it wasn't quite interesting enough. Combining it with `._compile` does make it more interesting. I've added it to my personal to-do list…"}}