{"action":"created","comment":{"url":"https://api.github.com/repos/js-reporters/js-reporters/pulls/comments/36181025","id":36181025,"diff_hunk":"@@ -0,0 +1,93 @@\n+import {Test, Suite} from \"../Data.js\";\n+\n+/*\n+ The TestReporter verifies that a test runner outputs the right data in the right order.\n+ To do so, it compares the actual output with the provided reference data.\n+ The result is given in the ok attribute.\n+ */\n+export default class TestReporter {\n+    /**\n+     * @param runner: standardized test runner (or adapter)\n+     * @param referenceData: An array of all expected (eventName, eventData) tuples in the right order\n+     */\n+    constructor(runner, referenceData) {\n+        this.referenceData = referenceData.slice();\n+        this.ok = undefined;\n+        runner.on(\"runStart\", this.onEvent.bind(this, \"runStart\"));\n+        runner.on(\"suiteStart\", this.onEvent.bind(this, \"suiteStart\"));\n+        runner.on(\"testStart\", this.onEvent.bind(this, \"testStart\"));\n+        runner.on(\"testEnd\", this.onEvent.bind(this, \"testEnd\"));\n+        runner.on(\"suiteEnd\", this.onEvent.bind(this, \"suiteEnd\"));\n+        runner.on(\"runEnd\", this.onEvent.bind(this, \"runEnd\"));\n+    }\n+\n+    /**\n+     * Gets called on each event emitted by the runner. Checks if the actual event matches the expected event.\n+     */\n+    onEvent(eventName, eventData) {\n+        var [expectedEventName, expectedEventData] = this.referenceData.shift();\n+\n+        if (expectedEventName === eventName && this.equals(expectedEventData, eventData)) {\n+            //event is as expected\n+            if (this.ok === undefined && this.referenceData.length === 0) {\n+                this.ok = true;\n+            }\n+        } else {\n+            this.ok = false;\n+            console.error(\"expected:\", expectedEventName, expectedEventData, \"actual:\", eventName, eventData);\n+        }\n+    }\n+\n+    /**\n+     * Helper function to compare\n+     *  - two Test objects\n+     *  - two Suite objects\n+     *  - two arrays of Test or Suite objects\n+     *  The equality check is not completely strict, e.g. the runtime of a Test does not have to be equal.\n+     * @returns {boolean}: true if both objects are equal, false otherwise\n+     */\n+    equals(expected, actual) {\n+        if (expected instanceof Suite) {\n+            if (expected.name !== actual.name) {\n+                return false;\n+            }\n+            if (!this.equals(expected.childSuites, actual.childSuites)) {\n+                return false;\n+            }\n+\n+            if (!this.equals(expected.tests, actual.tests)) {\n+                return false;\n+            }\n+\n+        } else if (expected instanceof Test) {\n+            for (let x of [\"testName\", \"suiteName\", \"status\", \"skipped\"]) {","path":"lib/reporters/TestReporter.js","position":63,"original_position":63,"commit_id":"10742b0f6a352476bbeb641adedba738318b1913","original_commit_id":"10742b0f6a352476bbeb641adedba738318b1913","user":{"login":"jzaefferer","id":52585,"avatar_url":"https://avatars.githubusercontent.com/u/52585?v=3","gravatar_id":"","url":"https://api.github.com/users/jzaefferer","html_url":"https://github.com/jzaefferer","followers_url":"https://api.github.com/users/jzaefferer/followers","following_url":"https://api.github.com/users/jzaefferer/following{/other_user}","gists_url":"https://api.github.com/users/jzaefferer/gists{/gist_id}","starred_url":"https://api.github.com/users/jzaefferer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzaefferer/subscriptions","organizations_url":"https://api.github.com/users/jzaefferer/orgs","repos_url":"https://api.github.com/users/jzaefferer/repos","events_url":"https://api.github.com/users/jzaefferer/events{/privacy}","received_events_url":"https://api.github.com/users/jzaefferer/received_events","type":"User","site_admin":false},"body":"Maybe use `property` as the variable name, instead of `x`?","created_at":"2015-08-04T12:18:25Z","updated_at":"2015-08-04T12:18:25Z","html_url":"https://github.com/js-reporters/js-reporters/pull/23#discussion_r36181025","pull_request_url":"https://api.github.com/repos/js-reporters/js-reporters/pulls/23","_links":{"self":{"href":"https://api.github.com/repos/js-reporters/js-reporters/pulls/comments/36181025"},"html":{"href":"https://github.com/js-reporters/js-reporters/pull/23#discussion_r36181025"},"pull_request":{"href":"https://api.github.com/repos/js-reporters/js-reporters/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/js-reporters/js-reporters/pulls/23","id":41260883,"html_url":"https://github.com/js-reporters/js-reporters/pull/23","diff_url":"https://github.com/js-reporters/js-reporters/pull/23.diff","patch_url":"https://github.com/js-reporters/js-reporters/pull/23.patch","issue_url":"https://api.github.com/repos/js-reporters/js-reporters/issues/23","number":23,"state":"open","locked":false,"title":"Automated test infrastructure","user":{"login":"fcarstens","id":11135872,"avatar_url":"https://avatars.githubusercontent.com/u/11135872?v=3","gravatar_id":"","url":"https://api.github.com/users/fcarstens","html_url":"https://github.com/fcarstens","followers_url":"https://api.github.com/users/fcarstens/followers","following_url":"https://api.github.com/users/fcarstens/following{/other_user}","gists_url":"https://api.github.com/users/fcarstens/gists{/gist_id}","starred_url":"https://api.github.com/users/fcarstens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fcarstens/subscriptions","organizations_url":"https://api.github.com/users/fcarstens/orgs","repos_url":"https://api.github.com/users/fcarstens/repos","events_url":"https://api.github.com/users/fcarstens/events{/privacy}","received_events_url":"https://api.github.com/users/fcarstens/received_events","type":"User","site_admin":false},"body":"This PR tries to set up a better test infrastructure and fixes a lot of bugs on the way. I accidentally included the qunit_umd_issue  and issue_19 branches, hope that's okay. :smiley: \r\n- unify QUnit and Jasmine test examples\r\n- add TestReporter which compares a runner's output to reference output\r\n- add reference output for Jasmine and QUnit\r\n- fix various bugs\r\n- add test script which runs the Jasmine tests in node (QUnit tbd)\r\n- Automated tests with Travis: https://travis-ci.org/fcarstens/js-reporters/builds  \r\nCan we enable this for the main repo as well?\r\n","created_at":"2015-07-30T17:39:11Z","updated_at":"2015-08-04T12:18:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bb28623a82a50bfd9985ff65ce45d86076b7a91e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/js-reporters/js-reporters/pulls/23/commits","review_comments_url":"https://api.github.com/repos/js-reporters/js-reporters/pulls/23/comments","review_comment_url":"https://api.github.com/repos/js-reporters/js-reporters/pulls/comments{/number}","comments_url":"https://api.github.com/repos/js-reporters/js-reporters/issues/23/comments","statuses_url":"https://api.github.com/repos/js-reporters/js-reporters/statuses/10742b0f6a352476bbeb641adedba738318b1913","head":{"label":"fcarstens:test","ref":"test","sha":"10742b0f6a352476bbeb641adedba738318b1913","user":{"login":"fcarstens","id":11135872,"avatar_url":"https://avatars.githubusercontent.com/u/11135872?v=3","gravatar_id":"","url":"https://api.github.com/users/fcarstens","html_url":"https://github.com/fcarstens","followers_url":"https://api.github.com/users/fcarstens/followers","following_url":"https://api.github.com/users/fcarstens/following{/other_user}","gists_url":"https://api.github.com/users/fcarstens/gists{/gist_id}","starred_url":"https://api.github.com/users/fcarstens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fcarstens/subscriptions","organizations_url":"https://api.github.com/users/fcarstens/orgs","repos_url":"https://api.github.com/users/fcarstens/repos","events_url":"https://api.github.com/users/fcarstens/events{/privacy}","received_events_url":"https://api.github.com/users/fcarstens/received_events","type":"User","site_admin":false},"repo":{"id":34922394,"name":"js-reporters","full_name":"fcarstens/js-reporters","owner":{"login":"fcarstens","id":11135872,"avatar_url":"https://avatars.githubusercontent.com/u/11135872?v=3","gravatar_id":"","url":"https://api.github.com/users/fcarstens","html_url":"https://github.com/fcarstens","followers_url":"https://api.github.com/users/fcarstens/followers","following_url":"https://api.github.com/users/fcarstens/following{/other_user}","gists_url":"https://api.github.com/users/fcarstens/gists{/gist_id}","starred_url":"https://api.github.com/users/fcarstens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fcarstens/subscriptions","organizations_url":"https://api.github.com/users/fcarstens/orgs","repos_url":"https://api.github.com/users/fcarstens/repos","events_url":"https://api.github.com/users/fcarstens/events{/privacy}","received_events_url":"https://api.github.com/users/fcarstens/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fcarstens/js-reporters","description":"The Common Reporter Interface (CRI) for JavaScript Unit Testing Frameworks","fork":true,"url":"https://api.github.com/repos/fcarstens/js-reporters","forks_url":"https://api.github.com/repos/fcarstens/js-reporters/forks","keys_url":"https://api.github.com/repos/fcarstens/js-reporters/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fcarstens/js-reporters/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fcarstens/js-reporters/teams","hooks_url":"https://api.github.com/repos/fcarstens/js-reporters/hooks","issue_events_url":"https://api.github.com/repos/fcarstens/js-reporters/issues/events{/number}","events_url":"https://api.github.com/repos/fcarstens/js-reporters/events","assignees_url":"https://api.github.com/repos/fcarstens/js-reporters/assignees{/user}","branches_url":"https://api.github.com/repos/fcarstens/js-reporters/branches{/branch}","tags_url":"https://api.github.com/repos/fcarstens/js-reporters/tags","blobs_url":"https://api.github.com/repos/fcarstens/js-reporters/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fcarstens/js-reporters/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fcarstens/js-reporters/git/refs{/sha}","trees_url":"https://api.github.com/repos/fcarstens/js-reporters/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fcarstens/js-reporters/statuses/{sha}","languages_url":"https://api.github.com/repos/fcarstens/js-reporters/languages","stargazers_url":"https://api.github.com/repos/fcarstens/js-reporters/stargazers","contributors_url":"https://api.github.com/repos/fcarstens/js-reporters/contributors","subscribers_url":"https://api.github.com/repos/fcarstens/js-reporters/subscribers","subscription_url":"https://api.github.com/repos/fcarstens/js-reporters/subscription","commits_url":"https://api.github.com/repos/fcarstens/js-reporters/commits{/sha}","git_commits_url":"https://api.github.com/repos/fcarstens/js-reporters/git/commits{/sha}","comments_url":"https://api.github.com/repos/fcarstens/js-reporters/comments{/number}","issue_comment_url":"https://api.github.com/repos/fcarstens/js-reporters/issues/comments{/number}","contents_url":"https://api.github.com/repos/fcarstens/js-reporters/contents/{+path}","compare_url":"https://api.github.com/repos/fcarstens/js-reporters/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fcarstens/js-reporters/merges","archive_url":"https://api.github.com/repos/fcarstens/js-reporters/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fcarstens/js-reporters/downloads","issues_url":"https://api.github.com/repos/fcarstens/js-reporters/issues{/number}","pulls_url":"https://api.github.com/repos/fcarstens/js-reporters/pulls{/number}","milestones_url":"https://api.github.com/repos/fcarstens/js-reporters/milestones{/number}","notifications_url":"https://api.github.com/repos/fcarstens/js-reporters/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fcarstens/js-reporters/labels{/name}","releases_url":"https://api.github.com/repos/fcarstens/js-reporters/releases{/id}","created_at":"2015-05-01T20:23:04Z","updated_at":"2015-07-11T12:13:44Z","pushed_at":"2015-08-03T12:42:07Z","git_url":"git://github.com/fcarstens/js-reporters.git","ssh_url":"git@github.com:fcarstens/js-reporters.git","clone_url":"https://github.com/fcarstens/js-reporters.git","svn_url":"https://github.com/fcarstens/js-reporters","homepage":"","size":411,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"js-reporters:master","ref":"master","sha":"8c5f713cb5882c746aa5850f58c18f16413cac20","user":{"login":"js-reporters","id":8627100,"avatar_url":"https://avatars.githubusercontent.com/u/8627100?v=3","gravatar_id":"","url":"https://api.github.com/users/js-reporters","html_url":"https://github.com/js-reporters","followers_url":"https://api.github.com/users/js-reporters/followers","following_url":"https://api.github.com/users/js-reporters/following{/other_user}","gists_url":"https://api.github.com/users/js-reporters/gists{/gist_id}","starred_url":"https://api.github.com/users/js-reporters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/js-reporters/subscriptions","organizations_url":"https://api.github.com/users/js-reporters/orgs","repos_url":"https://api.github.com/users/js-reporters/repos","events_url":"https://api.github.com/users/js-reporters/events{/privacy}","received_events_url":"https://api.github.com/users/js-reporters/received_events","type":"Organization","site_admin":false},"repo":{"id":23576276,"name":"js-reporters","full_name":"js-reporters/js-reporters","owner":{"login":"js-reporters","id":8627100,"avatar_url":"https://avatars.githubusercontent.com/u/8627100?v=3","gravatar_id":"","url":"https://api.github.com/users/js-reporters","html_url":"https://github.com/js-reporters","followers_url":"https://api.github.com/users/js-reporters/followers","following_url":"https://api.github.com/users/js-reporters/following{/other_user}","gists_url":"https://api.github.com/users/js-reporters/gists{/gist_id}","starred_url":"https://api.github.com/users/js-reporters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/js-reporters/subscriptions","organizations_url":"https://api.github.com/users/js-reporters/orgs","repos_url":"https://api.github.com/users/js-reporters/repos","events_url":"https://api.github.com/users/js-reporters/events{/privacy}","received_events_url":"https://api.github.com/users/js-reporters/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/js-reporters/js-reporters","description":"The Common Reporter Interface (CRI) for JavaScript Unit Testing Frameworks","fork":false,"url":"https://api.github.com/repos/js-reporters/js-reporters","forks_url":"https://api.github.com/repos/js-reporters/js-reporters/forks","keys_url":"https://api.github.com/repos/js-reporters/js-reporters/keys{/key_id}","collaborators_url":"https://api.github.com/repos/js-reporters/js-reporters/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/js-reporters/js-reporters/teams","hooks_url":"https://api.github.com/repos/js-reporters/js-reporters/hooks","issue_events_url":"https://api.github.com/repos/js-reporters/js-reporters/issues/events{/number}","events_url":"https://api.github.com/repos/js-reporters/js-reporters/events","assignees_url":"https://api.github.com/repos/js-reporters/js-reporters/assignees{/user}","branches_url":"https://api.github.com/repos/js-reporters/js-reporters/branches{/branch}","tags_url":"https://api.github.com/repos/js-reporters/js-reporters/tags","blobs_url":"https://api.github.com/repos/js-reporters/js-reporters/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/js-reporters/js-reporters/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/js-reporters/js-reporters/git/refs{/sha}","trees_url":"https://api.github.com/repos/js-reporters/js-reporters/git/trees{/sha}","statuses_url":"https://api.github.com/repos/js-reporters/js-reporters/statuses/{sha}","languages_url":"https://api.github.com/repos/js-reporters/js-reporters/languages","stargazers_url":"https://api.github.com/repos/js-reporters/js-reporters/stargazers","contributors_url":"https://api.github.com/repos/js-reporters/js-reporters/contributors","subscribers_url":"https://api.github.com/repos/js-reporters/js-reporters/subscribers","subscription_url":"https://api.github.com/repos/js-reporters/js-reporters/subscription","commits_url":"https://api.github.com/repos/js-reporters/js-reporters/commits{/sha}","git_commits_url":"https://api.github.com/repos/js-reporters/js-reporters/git/commits{/sha}","comments_url":"https://api.github.com/repos/js-reporters/js-reporters/comments{/number}","issue_comment_url":"https://api.github.com/repos/js-reporters/js-reporters/issues/comments{/number}","contents_url":"https://api.github.com/repos/js-reporters/js-reporters/contents/{+path}","compare_url":"https://api.github.com/repos/js-reporters/js-reporters/compare/{base}...{head}","merges_url":"https://api.github.com/repos/js-reporters/js-reporters/merges","archive_url":"https://api.github.com/repos/js-reporters/js-reporters/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/js-reporters/js-reporters/downloads","issues_url":"https://api.github.com/repos/js-reporters/js-reporters/issues{/number}","pulls_url":"https://api.github.com/repos/js-reporters/js-reporters/pulls{/number}","milestones_url":"https://api.github.com/repos/js-reporters/js-reporters/milestones{/number}","notifications_url":"https://api.github.com/repos/js-reporters/js-reporters/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/js-reporters/js-reporters/labels{/name}","releases_url":"https://api.github.com/repos/js-reporters/js-reporters/releases{/id}","created_at":"2014-09-02T11:34:04Z","updated_at":"2015-08-02T11:40:07Z","pushed_at":"2015-08-03T11:33:42Z","git_url":"git://github.com/js-reporters/js-reporters.git","ssh_url":"git@github.com:js-reporters/js-reporters.git","clone_url":"https://github.com/js-reporters/js-reporters.git","svn_url":"https://github.com/js-reporters/js-reporters","homepage":"","size":625,"stargazers_count":16,"watchers_count":16,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":13,"forks":2,"open_issues":13,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/js-reporters/js-reporters/pulls/23"},"html":{"href":"https://github.com/js-reporters/js-reporters/pull/23"},"issue":{"href":"https://api.github.com/repos/js-reporters/js-reporters/issues/23"},"comments":{"href":"https://api.github.com/repos/js-reporters/js-reporters/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/js-reporters/js-reporters/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/js-reporters/js-reporters/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/js-reporters/js-reporters/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/js-reporters/js-reporters/statuses/10742b0f6a352476bbeb641adedba738318b1913"}}}}