{"action":"created","comment":{"url":"https://api.github.com/repos/xitu/gold-miner/pulls/comments/71630686","id":71630686,"diff_hunk":"@@ -1,28 +1,27 @@\n * 原文链接：[Learning How to Set Up Automated, Cross-browser JavaScript Unit Testing](https://philipwalton.com/articles/learning-how-to-set-up-automated-cross-browser-javascript-unit-testing)\n * 原文作者：[PHILIP WALTON](https://philipwalton.com/)\n * 译文出自：[掘金翻译计划](https://github.com/xitu/gold-miner)\n-* 译者：[认领地址](https://github.com/xitu/gold-miner/issues/539)\n+* 译者：owenlyn\n * 校对者：\n \n-We all know how important it is to test our code in multiple browsers. And I think for the most part, we in the web development community do a pretty good job at this—at least when first releasing a project.\n+我们都知道在各个不同的浏览器环境里测试代码是很重要的， 并且在大多数时候，我们作为Web开发者在这一点上是做的很好的 —— 至少在第一次发布的时候是这样。\n \n-What we don’t do a good job of is testing our code every time we make a change.\n+然而我们在每次更改代码之后的测试方面，却做的不尽人意。\n \n-I know I’m personally guilty of this. I’ve had “learn how to set up automated, cross-browser JavaScript unit testing” on my to-do list for years, but every time I sat down to really figure it out, I gave up. While I’m sure this was partially due to my laziness, I think it was also due to the surprising lack of good information available on this topic.\n+我深切地知道我本人就是这样的 —— 我早就把“学习怎样建立自动化、跨浏览器的JavaScript单元测试”写在To-do List上了，但每当我坐下来想要真正的去解决这个问题的时候，我却不得不一次次地放弃了。虽然我知道我的懒惰是其中一部分原因，但同时，在这个问题上的相关信息极其匮乏，也是一个重要因素。\n \n-There are a lot of tools and frameworks out there (like Karma) that claim to “make automated, JavaScript testing easy”, but in my experience these tools introduce more complexity than they get rid of (more on this later). In my experience, tools that “just work” can be nice once you’re an expert, but they’re terrible for learning. And what I wanted was to actually understand how this process worked under the hood, so that when it broke (which it always eventually does), I could fix it.\n+现在已经有了很多声称可以让“JavasScript测试变得简单而又自动化”的工具和框架（比如Karma），但从我的经验来看，这些工具创造的麻烦比它们解决的问题还要多。那些“有求必应”的工具会在你掌握了它们之后变得很好用，但往往掌握使用这些工具的技巧本身就是个难题。而且更进一步来说，我想要的时真正地理解这个过程和它的原理，这样我才能在遇到问题的时候解决问题。\n \n-For me, the best way to fully understand how something works is to try to recreate it from scratch myself. So I decided to build my own testing tool, and then share what I learned with the community.\n+对我来说，最好的学习方法就是尝试着把一件事情从零开始做一遍，所以我决定自己写一个测试工具，然后把我从中学到的分享给开发者社区。\n \n-I’m writing this article because it’s the article I wish existed years ago when I first started releasing open source projects. If you’ve never set up automated, cross-browser JavaScript unit testing yourself but have always wanted to learn, then this article is for you. It will explain how the process works and show you how to do it yourself.\n+我之所以写这篇文章，是因为我多么希望像这样的文章，是在多年之前当我开始发布开源项目的时候就已经存在的。如果你也想做自动化的跨浏览器JavaScript单元测试，却从未尝试过，那么这篇文章就是为你而写的。这篇文章将会阐释这个过程并教你怎么自己去做。\n \n-## The manual testing process\n+## 手工测试过程\n \n-Before I explain the automated process, I think it’s important to make sure we’re all on the same page about how the manual process works.\n+在我解释自动化测试之前，我决定有必要确认一下我们对怎么做手工测试的理解是一致的。\n+毕竟，自动化测试只是用机器代替人去不停重复一个已经存在的流程。如果你不能完全理解怎样去做手工测试，那么你也不太可能理解自动化测试的过程。","path":"TODO/learning-how-to-set-up-automated-cross-browser-javascript-unit-testing.md","position":30,"original_position":31,"commit_id":"45d5176aafbe176ec1ae59496ea9d486548b8458","original_commit_id":"45d5176aafbe176ec1ae59496ea9d486548b8458","user":{"login":"MAYDAY1993","id":14831051,"avatar_url":"https://avatars.githubusercontent.com/u/14831051?v=3","gravatar_id":"","url":"https://api.github.com/users/MAYDAY1993","html_url":"https://github.com/MAYDAY1993","followers_url":"https://api.github.com/users/MAYDAY1993/followers","following_url":"https://api.github.com/users/MAYDAY1993/following{/other_user}","gists_url":"https://api.github.com/users/MAYDAY1993/gists{/gist_id}","starred_url":"https://api.github.com/users/MAYDAY1993/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MAYDAY1993/subscriptions","organizations_url":"https://api.github.com/users/MAYDAY1993/orgs","repos_url":"https://api.github.com/users/MAYDAY1993/repos","events_url":"https://api.github.com/users/MAYDAY1993/events{/privacy}","received_events_url":"https://api.github.com/users/MAYDAY1993/received_events","type":"User","site_admin":false},"body":"'如果你不能完全理解怎样去做手工测试，'\r\n-->\r\n'如果你不能完全理解手工测试过程就尝试自动化，'","created_at":"2016-07-21T00:30:00Z","updated_at":"2016-07-21T00:30:00Z","html_url":"https://github.com/xitu/gold-miner/pull/554#discussion_r71630686","pull_request_url":"https://api.github.com/repos/xitu/gold-miner/pulls/554","_links":{"self":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/comments/71630686"},"html":{"href":"https://github.com/xitu/gold-miner/pull/554#discussion_r71630686"},"pull_request":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/554"}}},"pull_request":{"url":"https://api.github.com/repos/xitu/gold-miner/pulls/554","id":78092956,"html_url":"https://github.com/xitu/gold-miner/pull/554","diff_url":"https://github.com/xitu/gold-miner/pull/554.diff","patch_url":"https://github.com/xitu/gold-miner/pull/554.patch","issue_url":"https://api.github.com/repos/xitu/gold-miner/issues/554","number":554,"state":"open","locked":false,"title":"如何编写自动化、跨浏览器的 Javascript 单元测试？","user":{"login":"owenlyn","id":4431857,"avatar_url":"https://avatars.githubusercontent.com/u/4431857?v=3","gravatar_id":"","url":"https://api.github.com/users/owenlyn","html_url":"https://github.com/owenlyn","followers_url":"https://api.github.com/users/owenlyn/followers","following_url":"https://api.github.com/users/owenlyn/following{/other_user}","gists_url":"https://api.github.com/users/owenlyn/gists{/gist_id}","starred_url":"https://api.github.com/users/owenlyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owenlyn/subscriptions","organizations_url":"https://api.github.com/users/owenlyn/orgs","repos_url":"https://api.github.com/users/owenlyn/repos","events_url":"https://api.github.com/users/owenlyn/events{/privacy}","received_events_url":"https://api.github.com/users/owenlyn/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-20T06:06:43Z","updated_at":"2016-07-21T00:30:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9aee601eff6c0acb3ccd32c0a38da505ce627cdb","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/xitu/gold-miner/pulls/554/commits","review_comments_url":"https://api.github.com/repos/xitu/gold-miner/pulls/554/comments","review_comment_url":"https://api.github.com/repos/xitu/gold-miner/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xitu/gold-miner/issues/554/comments","statuses_url":"https://api.github.com/repos/xitu/gold-miner/statuses/45d5176aafbe176ec1ae59496ea9d486548b8458","head":{"label":"owenlyn:translate","ref":"translate","sha":"45d5176aafbe176ec1ae59496ea9d486548b8458","user":{"login":"owenlyn","id":4431857,"avatar_url":"https://avatars.githubusercontent.com/u/4431857?v=3","gravatar_id":"","url":"https://api.github.com/users/owenlyn","html_url":"https://github.com/owenlyn","followers_url":"https://api.github.com/users/owenlyn/followers","following_url":"https://api.github.com/users/owenlyn/following{/other_user}","gists_url":"https://api.github.com/users/owenlyn/gists{/gist_id}","starred_url":"https://api.github.com/users/owenlyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owenlyn/subscriptions","organizations_url":"https://api.github.com/users/owenlyn/orgs","repos_url":"https://api.github.com/users/owenlyn/repos","events_url":"https://api.github.com/users/owenlyn/events{/privacy}","received_events_url":"https://api.github.com/users/owenlyn/received_events","type":"User","site_admin":false},"repo":{"id":63524125,"name":"gold-miner","full_name":"owenlyn/gold-miner","owner":{"login":"owenlyn","id":4431857,"avatar_url":"https://avatars.githubusercontent.com/u/4431857?v=3","gravatar_id":"","url":"https://api.github.com/users/owenlyn","html_url":"https://github.com/owenlyn","followers_url":"https://api.github.com/users/owenlyn/followers","following_url":"https://api.github.com/users/owenlyn/following{/other_user}","gists_url":"https://api.github.com/users/owenlyn/gists{/gist_id}","starred_url":"https://api.github.com/users/owenlyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owenlyn/subscriptions","organizations_url":"https://api.github.com/users/owenlyn/orgs","repos_url":"https://api.github.com/users/owenlyn/repos","events_url":"https://api.github.com/users/owenlyn/events{/privacy}","received_events_url":"https://api.github.com/users/owenlyn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/owenlyn/gold-miner","description":"掘金翻译计划，翻译掘金上优质的英文文章","fork":true,"url":"https://api.github.com/repos/owenlyn/gold-miner","forks_url":"https://api.github.com/repos/owenlyn/gold-miner/forks","keys_url":"https://api.github.com/repos/owenlyn/gold-miner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/owenlyn/gold-miner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/owenlyn/gold-miner/teams","hooks_url":"https://api.github.com/repos/owenlyn/gold-miner/hooks","issue_events_url":"https://api.github.com/repos/owenlyn/gold-miner/issues/events{/number}","events_url":"https://api.github.com/repos/owenlyn/gold-miner/events","assignees_url":"https://api.github.com/repos/owenlyn/gold-miner/assignees{/user}","branches_url":"https://api.github.com/repos/owenlyn/gold-miner/branches{/branch}","tags_url":"https://api.github.com/repos/owenlyn/gold-miner/tags","blobs_url":"https://api.github.com/repos/owenlyn/gold-miner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/owenlyn/gold-miner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/owenlyn/gold-miner/git/refs{/sha}","trees_url":"https://api.github.com/repos/owenlyn/gold-miner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/owenlyn/gold-miner/statuses/{sha}","languages_url":"https://api.github.com/repos/owenlyn/gold-miner/languages","stargazers_url":"https://api.github.com/repos/owenlyn/gold-miner/stargazers","contributors_url":"https://api.github.com/repos/owenlyn/gold-miner/contributors","subscribers_url":"https://api.github.com/repos/owenlyn/gold-miner/subscribers","subscription_url":"https://api.github.com/repos/owenlyn/gold-miner/subscription","commits_url":"https://api.github.com/repos/owenlyn/gold-miner/commits{/sha}","git_commits_url":"https://api.github.com/repos/owenlyn/gold-miner/git/commits{/sha}","comments_url":"https://api.github.com/repos/owenlyn/gold-miner/comments{/number}","issue_comment_url":"https://api.github.com/repos/owenlyn/gold-miner/issues/comments{/number}","contents_url":"https://api.github.com/repos/owenlyn/gold-miner/contents/{+path}","compare_url":"https://api.github.com/repos/owenlyn/gold-miner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/owenlyn/gold-miner/merges","archive_url":"https://api.github.com/repos/owenlyn/gold-miner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/owenlyn/gold-miner/downloads","issues_url":"https://api.github.com/repos/owenlyn/gold-miner/issues{/number}","pulls_url":"https://api.github.com/repos/owenlyn/gold-miner/pulls{/number}","milestones_url":"https://api.github.com/repos/owenlyn/gold-miner/milestones{/number}","notifications_url":"https://api.github.com/repos/owenlyn/gold-miner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/owenlyn/gold-miner/labels{/name}","releases_url":"https://api.github.com/repos/owenlyn/gold-miner/releases{/id}","deployments_url":"https://api.github.com/repos/owenlyn/gold-miner/deployments","created_at":"2016-07-17T09:26:00Z","updated_at":"2016-07-17T06:41:19Z","pushed_at":"2016-07-19T20:26:02Z","git_url":"git://github.com/owenlyn/gold-miner.git","ssh_url":"git@github.com:owenlyn/gold-miner.git","clone_url":"https://github.com/owenlyn/gold-miner.git","svn_url":"https://github.com/owenlyn/gold-miner","homepage":"http://gold.xitu.io","size":13985,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"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":"xitu:master","ref":"master","sha":"7239f0fda162876a957417f29fe2f57487dda938","user":{"login":"xitu","id":10482599,"avatar_url":"https://avatars.githubusercontent.com/u/10482599?v=3","gravatar_id":"","url":"https://api.github.com/users/xitu","html_url":"https://github.com/xitu","followers_url":"https://api.github.com/users/xitu/followers","following_url":"https://api.github.com/users/xitu/following{/other_user}","gists_url":"https://api.github.com/users/xitu/gists{/gist_id}","starred_url":"https://api.github.com/users/xitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitu/subscriptions","organizations_url":"https://api.github.com/users/xitu/orgs","repos_url":"https://api.github.com/users/xitu/repos","events_url":"https://api.github.com/users/xitu/events{/privacy}","received_events_url":"https://api.github.com/users/xitu/received_events","type":"Organization","site_admin":false},"repo":{"id":45512989,"name":"gold-miner","full_name":"xitu/gold-miner","owner":{"login":"xitu","id":10482599,"avatar_url":"https://avatars.githubusercontent.com/u/10482599?v=3","gravatar_id":"","url":"https://api.github.com/users/xitu","html_url":"https://github.com/xitu","followers_url":"https://api.github.com/users/xitu/followers","following_url":"https://api.github.com/users/xitu/following{/other_user}","gists_url":"https://api.github.com/users/xitu/gists{/gist_id}","starred_url":"https://api.github.com/users/xitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitu/subscriptions","organizations_url":"https://api.github.com/users/xitu/orgs","repos_url":"https://api.github.com/users/xitu/repos","events_url":"https://api.github.com/users/xitu/events{/privacy}","received_events_url":"https://api.github.com/users/xitu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xitu/gold-miner","description":"掘金翻译计划，翻译掘金上优质的英文文章","fork":false,"url":"https://api.github.com/repos/xitu/gold-miner","forks_url":"https://api.github.com/repos/xitu/gold-miner/forks","keys_url":"https://api.github.com/repos/xitu/gold-miner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xitu/gold-miner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xitu/gold-miner/teams","hooks_url":"https://api.github.com/repos/xitu/gold-miner/hooks","issue_events_url":"https://api.github.com/repos/xitu/gold-miner/issues/events{/number}","events_url":"https://api.github.com/repos/xitu/gold-miner/events","assignees_url":"https://api.github.com/repos/xitu/gold-miner/assignees{/user}","branches_url":"https://api.github.com/repos/xitu/gold-miner/branches{/branch}","tags_url":"https://api.github.com/repos/xitu/gold-miner/tags","blobs_url":"https://api.github.com/repos/xitu/gold-miner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xitu/gold-miner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xitu/gold-miner/git/refs{/sha}","trees_url":"https://api.github.com/repos/xitu/gold-miner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xitu/gold-miner/statuses/{sha}","languages_url":"https://api.github.com/repos/xitu/gold-miner/languages","stargazers_url":"https://api.github.com/repos/xitu/gold-miner/stargazers","contributors_url":"https://api.github.com/repos/xitu/gold-miner/contributors","subscribers_url":"https://api.github.com/repos/xitu/gold-miner/subscribers","subscription_url":"https://api.github.com/repos/xitu/gold-miner/subscription","commits_url":"https://api.github.com/repos/xitu/gold-miner/commits{/sha}","git_commits_url":"https://api.github.com/repos/xitu/gold-miner/git/commits{/sha}","comments_url":"https://api.github.com/repos/xitu/gold-miner/comments{/number}","issue_comment_url":"https://api.github.com/repos/xitu/gold-miner/issues/comments{/number}","contents_url":"https://api.github.com/repos/xitu/gold-miner/contents/{+path}","compare_url":"https://api.github.com/repos/xitu/gold-miner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xitu/gold-miner/merges","archive_url":"https://api.github.com/repos/xitu/gold-miner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xitu/gold-miner/downloads","issues_url":"https://api.github.com/repos/xitu/gold-miner/issues{/number}","pulls_url":"https://api.github.com/repos/xitu/gold-miner/pulls{/number}","milestones_url":"https://api.github.com/repos/xitu/gold-miner/milestones{/number}","notifications_url":"https://api.github.com/repos/xitu/gold-miner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xitu/gold-miner/labels{/name}","releases_url":"https://api.github.com/repos/xitu/gold-miner/releases{/id}","deployments_url":"https://api.github.com/repos/xitu/gold-miner/deployments","created_at":"2015-11-04T03:29:13Z","updated_at":"2016-07-20T17:02:44Z","pushed_at":"2016-07-20T12:12:53Z","git_url":"git://github.com/xitu/gold-miner.git","ssh_url":"git@github.com:xitu/gold-miner.git","clone_url":"https://github.com/xitu/gold-miner.git","svn_url":"https://github.com/xitu/gold-miner","homepage":"http://gold.xitu.io","size":14843,"stargazers_count":2489,"watchers_count":2489,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":475,"mirror_url":null,"open_issues_count":14,"forks":475,"open_issues":14,"watchers":2489,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/554"},"html":{"href":"https://github.com/xitu/gold-miner/pull/554"},"issue":{"href":"https://api.github.com/repos/xitu/gold-miner/issues/554"},"comments":{"href":"https://api.github.com/repos/xitu/gold-miner/issues/554/comments"},"review_comments":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/554/comments"},"review_comment":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/554/commits"},"statuses":{"href":"https://api.github.com/repos/xitu/gold-miner/statuses/45d5176aafbe176ec1ae59496ea9d486548b8458"}}}}
{"actor":{"display_login":"MAYDAY1993"}}