{"action":"created","comment":{"url":"https://api.github.com/repos/sindresorhus/ava-docs/pulls/comments/57128593","id":57128593,"diff_hunk":"@@ -0,0 +1,105 @@\n+___\n+**备注**\n+\n+这是[watch-mode.md](https://github.com/sindresorhus/ava/blob/master/docs/recipes/watch-mode.md)的简体中文翻译。这个[链接](https://github.com/sindresorhus/ava/compare/82c02bce80696547db0387dec243ddb470c8bce7...master#diff-92da4f3d087d796fdf4a45be88586b62)用来查看本翻译与AVA 的master 分支是否有差别（如果你没有看到`watch-mode.md`发生变化，那就意味着这份翻译文档是最新的）。\n+___\n+\n+# 观察模式\n+\n+翻译: [Français](https://github.com/sindresorhus/ava-docs/blob/master/fr_FR/docs/recipes/watch-mode.md), [Русский](https://github.com/sindresorhus/ava-docs/blob/master/ru_RU/docs/recipes/watch-mode.md), [简体中文](https://github.com/sindresorhus/ava-docs/blob/master/zh_CN/docs/recipes/watch-mode.md)\n+\n+\n+AVA 自带了一个聪明的观察模式，它会观察那些改变了的文件并运行受到改变影响的测试。\n+\n+## 运行测试时启用观察模式\n+\n+你可以通过使用`--watch`或`-w`标志来启用观察模式，如果你是全局安装的AVA：\n+\n+```console\n+$ ava --watch\n+```\n+\n+如果你将AVA 配置在`package.json`中，像这样：\n+\n+```json\n+{\n+  \"scripts\": {\n+    \"test\": \"ava\"\n+  }\n+}\n+```\n+\n+你可以这样运行：\n+\n+```console\n+$ npm test -- --watch\n+```\n+\n+你可以设置一个特殊的脚本：\n+\n+```json\n+{\n+  \"scripts\": {\n+    \"test\": \"ava\",\n+    \"test:watch\": \"ava --watch\"\n+  }\n+}\n+```\n+\n+然后使用：\n+\n+```console\n+$ npm run test:watch\n+```\n+\n+## 要求\n+\n+AVA 使用[`chokidar`]来作为文件观察器，它被配置为可选的依赖库，因为`chokidar`有时候无法安装，如果`chokidar`安装失败那么观察模式就不可用，然后你将看到一条这样的信息：\n+\n+> The optional dependency chokidar failed to install and is required for --watch. Chokidar is likely not supported on your platform.\n+\n+请参考[`chokidar`文档][`chokidar`]了解如何解决这个问题。\n+\n+## 源文件和测试文件\n+\n+在AVA 中*源文件*和*测试文件*是有差别的，正如你所想的一样，*测试文件*包含了你的测试，*源文件*是需要支持测试运行的其他所有文件，是你的源代码或者测试数据。\n+\n+默认情况下AVA 观察测试文件，`package.json`和其他的`.js`文件的改变，它会忽略由[`ignore-by-default`]包提供的[特定文件夹](https://github.com/novemberborn/ignore-by-default/blob/master/index.js)下的文件。\n+\n+你可以使用[`--source` CLI 标志]或`package.json`文件的`ava`属性为源文件配置模式，注意如果你从[`ignore-by-default`]中指定了一个负模式目录，那么忽略将不再有效，所以你可能想要在你的配置里重复这些操作。\n+\n+如果你的测试会写入磁盘，那么它们会跟踪观察器来返回你的测试，这种情况下你需要使用`--source`标志。","path":"zh_CN/docs/recipes/watch-mode.md","position":71,"original_position":71,"commit_id":"1a4a3a6dcf9dc5ba63b0b908495caf511e0749b4","original_commit_id":"1a4a3a6dcf9dc5ba63b0b908495caf511e0749b4","user":{"login":"XadillaX","id":2842176,"avatar_url":"https://avatars.githubusercontent.com/u/2842176?v=3","gravatar_id":"","url":"https://api.github.com/users/XadillaX","html_url":"https://github.com/XadillaX","followers_url":"https://api.github.com/users/XadillaX/followers","following_url":"https://api.github.com/users/XadillaX/following{/other_user}","gists_url":"https://api.github.com/users/XadillaX/gists{/gist_id}","starred_url":"https://api.github.com/users/XadillaX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XadillaX/subscriptions","organizations_url":"https://api.github.com/users/XadillaX/orgs","repos_url":"https://api.github.com/users/XadillaX/repos","events_url":"https://api.github.com/users/XadillaX/events{/privacy}","received_events_url":"https://api.github.com/users/XadillaX/received_events","type":"User","site_admin":false},"body":"> 如果你的测试会写入磁盘，那么它们会跟踪观察器来返回你的测试，这种情况下你需要使用 `--source` 标志。","created_at":"2016-03-23T09:19:14Z","updated_at":"2016-03-23T09:19:14Z","html_url":"https://github.com/sindresorhus/ava-docs/pull/17#discussion_r57128593","pull_request_url":"https://api.github.com/repos/sindresorhus/ava-docs/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/sindresorhus/ava-docs/pulls/comments/57128593"},"html":{"href":"https://github.com/sindresorhus/ava-docs/pull/17#discussion_r57128593"},"pull_request":{"href":"https://api.github.com/repos/sindresorhus/ava-docs/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/sindresorhus/ava-docs/pulls/17","id":63472464,"html_url":"https://github.com/sindresorhus/ava-docs/pull/17","diff_url":"https://github.com/sindresorhus/ava-docs/pull/17.diff","patch_url":"https://github.com/sindresorhus/ava-docs/pull/17.patch","issue_url":"https://api.github.com/repos/sindresorhus/ava-docs/issues/17","number":17,"state":"open","locked":false,"title":"translate AVA docs to zh_CN","user":{"login":"zhaozhiming","id":1436694,"avatar_url":"https://avatars.githubusercontent.com/u/1436694?v=3","gravatar_id":"","url":"https://api.github.com/users/zhaozhiming","html_url":"https://github.com/zhaozhiming","followers_url":"https://api.github.com/users/zhaozhiming/followers","following_url":"https://api.github.com/users/zhaozhiming/following{/other_user}","gists_url":"https://api.github.com/users/zhaozhiming/gists{/gist_id}","starred_url":"https://api.github.com/users/zhaozhiming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhaozhiming/subscriptions","organizations_url":"https://api.github.com/users/zhaozhiming/orgs","repos_url":"https://api.github.com/users/zhaozhiming/repos","events_url":"https://api.github.com/users/zhaozhiming/events{/privacy}","received_events_url":"https://api.github.com/users/zhaozhiming/received_events","type":"User","site_admin":false},"body":"HI, \r\nI like AVA and I want to translate the docs of AVA to Chinese, which will help more Chinese people study and use AVA.\r\n@all I have translated all the docs already, please review, thank you very much.\r\n\r\ntodo list:\r\n- [x] readme.md\r\n- [x] contributing.md\r\n- [x] code-of-conduct.md\r\n- [x] docs/recipes/browser-testing.md\r\n- [x] docs/recipes/code-coverage.md\r\n- [x] docs/recipes/endpoint-testing.md\r\n- [x] docs/recipes/typescript.md\r\n- [x] docs/recipes/watch-mode.md\r\n- [x] docs/recipes/when-to-use-plan.md","created_at":"2016-03-19T16:54:44Z","updated_at":"2016-03-23T09:19:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e7be3621ebb9cea040d818ceb7d1d8bbfb8fc46","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sindresorhus/ava-docs/pulls/17/commits","review_comments_url":"https://api.github.com/repos/sindresorhus/ava-docs/pulls/17/comments","review_comment_url":"https://api.github.com/repos/sindresorhus/ava-docs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sindresorhus/ava-docs/issues/17/comments","statuses_url":"https://api.github.com/repos/sindresorhus/ava-docs/statuses/1a4a3a6dcf9dc5ba63b0b908495caf511e0749b4","head":{"label":"zhaozhiming:zh_CN","ref":"zh_CN","sha":"1a4a3a6dcf9dc5ba63b0b908495caf511e0749b4","user":{"login":"zhaozhiming","id":1436694,"avatar_url":"https://avatars.githubusercontent.com/u/1436694?v=3","gravatar_id":"","url":"https://api.github.com/users/zhaozhiming","html_url":"https://github.com/zhaozhiming","followers_url":"https://api.github.com/users/zhaozhiming/followers","following_url":"https://api.github.com/users/zhaozhiming/following{/other_user}","gists_url":"https://api.github.com/users/zhaozhiming/gists{/gist_id}","starred_url":"https://api.github.com/users/zhaozhiming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhaozhiming/subscriptions","organizations_url":"https://api.github.com/users/zhaozhiming/orgs","repos_url":"https://api.github.com/users/zhaozhiming/repos","events_url":"https://api.github.com/users/zhaozhiming/events{/privacy}","received_events_url":"https://api.github.com/users/zhaozhiming/received_events","type":"User","site_admin":false},"repo":{"id":54176506,"name":"ava-docs","full_name":"zhaozhiming/ava-docs","owner":{"login":"zhaozhiming","id":1436694,"avatar_url":"https://avatars.githubusercontent.com/u/1436694?v=3","gravatar_id":"","url":"https://api.github.com/users/zhaozhiming","html_url":"https://github.com/zhaozhiming","followers_url":"https://api.github.com/users/zhaozhiming/followers","following_url":"https://api.github.com/users/zhaozhiming/following{/other_user}","gists_url":"https://api.github.com/users/zhaozhiming/gists{/gist_id}","starred_url":"https://api.github.com/users/zhaozhiming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhaozhiming/subscriptions","organizations_url":"https://api.github.com/users/zhaozhiming/orgs","repos_url":"https://api.github.com/users/zhaozhiming/repos","events_url":"https://api.github.com/users/zhaozhiming/events{/privacy}","received_events_url":"https://api.github.com/users/zhaozhiming/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zhaozhiming/ava-docs","description":"Localized docs for AVA","fork":true,"url":"https://api.github.com/repos/zhaozhiming/ava-docs","forks_url":"https://api.github.com/repos/zhaozhiming/ava-docs/forks","keys_url":"https://api.github.com/repos/zhaozhiming/ava-docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zhaozhiming/ava-docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zhaozhiming/ava-docs/teams","hooks_url":"https://api.github.com/repos/zhaozhiming/ava-docs/hooks","issue_events_url":"https://api.github.com/repos/zhaozhiming/ava-docs/issues/events{/number}","events_url":"https://api.github.com/repos/zhaozhiming/ava-docs/events","assignees_url":"https://api.github.com/repos/zhaozhiming/ava-docs/assignees{/user}","branches_url":"https://api.github.com/repos/zhaozhiming/ava-docs/branches{/branch}","tags_url":"https://api.github.com/repos/zhaozhiming/ava-docs/tags","blobs_url":"https://api.github.com/repos/zhaozhiming/ava-docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zhaozhiming/ava-docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zhaozhiming/ava-docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/zhaozhiming/ava-docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zhaozhiming/ava-docs/statuses/{sha}","languages_url":"https://api.github.com/repos/zhaozhiming/ava-docs/languages","stargazers_url":"https://api.github.com/repos/zhaozhiming/ava-docs/stargazers","contributors_url":"https://api.github.com/repos/zhaozhiming/ava-docs/contributors","subscribers_url":"https://api.github.com/repos/zhaozhiming/ava-docs/subscribers","subscription_url":"https://api.github.com/repos/zhaozhiming/ava-docs/subscription","commits_url":"https://api.github.com/repos/zhaozhiming/ava-docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/zhaozhiming/ava-docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/zhaozhiming/ava-docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/zhaozhiming/ava-docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/zhaozhiming/ava-docs/contents/{+path}","compare_url":"https://api.github.com/repos/zhaozhiming/ava-docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zhaozhiming/ava-docs/merges","archive_url":"https://api.github.com/repos/zhaozhiming/ava-docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zhaozhiming/ava-docs/downloads","issues_url":"https://api.github.com/repos/zhaozhiming/ava-docs/issues{/number}","pulls_url":"https://api.github.com/repos/zhaozhiming/ava-docs/pulls{/number}","milestones_url":"https://api.github.com/repos/zhaozhiming/ava-docs/milestones{/number}","notifications_url":"https://api.github.com/repos/zhaozhiming/ava-docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zhaozhiming/ava-docs/labels{/name}","releases_url":"https://api.github.com/repos/zhaozhiming/ava-docs/releases{/id}","deployments_url":"https://api.github.com/repos/zhaozhiming/ava-docs/deployments","created_at":"2016-03-18T05:34:09Z","updated_at":"2016-03-15T20:10:19Z","pushed_at":"2016-03-21T12:47:17Z","git_url":"git://github.com/zhaozhiming/ava-docs.git","ssh_url":"git@github.com:zhaozhiming/ava-docs.git","clone_url":"https://github.com/zhaozhiming/ava-docs.git","svn_url":"https://github.com/zhaozhiming/ava-docs","homepage":null,"size":306,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sindresorhus:master","ref":"master","sha":"9849ccb8b6797f66827221c16796453013c9f9ef","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},"repo":{"id":47849128,"name":"ava-docs","full_name":"sindresorhus/ava-docs","owner":{"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},"private":false,"html_url":"https://github.com/sindresorhus/ava-docs","description":"Localized docs for AVA","fork":false,"url":"https://api.github.com/repos/sindresorhus/ava-docs","forks_url":"https://api.github.com/repos/sindresorhus/ava-docs/forks","keys_url":"https://api.github.com/repos/sindresorhus/ava-docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sindresorhus/ava-docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sindresorhus/ava-docs/teams","hooks_url":"https://api.github.com/repos/sindresorhus/ava-docs/hooks","issue_events_url":"https://api.github.com/repos/sindresorhus/ava-docs/issues/events{/number}","events_url":"https://api.github.com/repos/sindresorhus/ava-docs/events","assignees_url":"https://api.github.com/repos/sindresorhus/ava-docs/assignees{/user}","branches_url":"https://api.github.com/repos/sindresorhus/ava-docs/branches{/branch}","tags_url":"https://api.github.com/repos/sindresorhus/ava-docs/tags","blobs_url":"https://api.github.com/repos/sindresorhus/ava-docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sindresorhus/ava-docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sindresorhus/ava-docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/sindresorhus/ava-docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sindresorhus/ava-docs/statuses/{sha}","languages_url":"https://api.github.com/repos/sindresorhus/ava-docs/languages","stargazers_url":"https://api.github.com/repos/sindresorhus/ava-docs/stargazers","contributors_url":"https://api.github.com/repos/sindresorhus/ava-docs/contributors","subscribers_url":"https://api.github.com/repos/sindresorhus/ava-docs/subscribers","subscription_url":"https://api.github.com/repos/sindresorhus/ava-docs/subscription","commits_url":"https://api.github.com/repos/sindresorhus/ava-docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/sindresorhus/ava-docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/sindresorhus/ava-docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/sindresorhus/ava-docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/sindresorhus/ava-docs/contents/{+path}","compare_url":"https://api.github.com/repos/sindresorhus/ava-docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sindresorhus/ava-docs/merges","archive_url":"https://api.github.com/repos/sindresorhus/ava-docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sindresorhus/ava-docs/downloads","issues_url":"https://api.github.com/repos/sindresorhus/ava-docs/issues{/number}","pulls_url":"https://api.github.com/repos/sindresorhus/ava-docs/pulls{/number}","milestones_url":"https://api.github.com/repos/sindresorhus/ava-docs/milestones{/number}","notifications_url":"https://api.github.com/repos/sindresorhus/ava-docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sindresorhus/ava-docs/labels{/name}","releases_url":"https://api.github.com/repos/sindresorhus/ava-docs/releases{/id}","deployments_url":"https://api.github.com/repos/sindresorhus/ava-docs/deployments","created_at":"2015-12-11T20:22:55Z","updated_at":"2016-03-21T15:34:16Z","pushed_at":"2016-03-23T08:16:48Z","git_url":"git://github.com/sindresorhus/ava-docs.git","ssh_url":"git@github.com:sindresorhus/ava-docs.git","clone_url":"https://github.com/sindresorhus/ava-docs.git","svn_url":"https://github.com/sindresorhus/ava-docs","homepage":null,"size":468,"stargazers_count":26,"watchers_count":26,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":5,"forks":19,"open_issues":5,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sindresorhus/ava-docs/pulls/17"},"html":{"href":"https://github.com/sindresorhus/ava-docs/pull/17"},"issue":{"href":"https://api.github.com/repos/sindresorhus/ava-docs/issues/17"},"comments":{"href":"https://api.github.com/repos/sindresorhus/ava-docs/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/sindresorhus/ava-docs/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/sindresorhus/ava-docs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sindresorhus/ava-docs/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/sindresorhus/ava-docs/statuses/1a4a3a6dcf9dc5ba63b0b908495caf511e0749b4"}}}}