{"action":"created","comment":{"url":"https://api.github.com/repos/loadimpact/k6/pulls/comments/221505634","pull_request_review_id":160167664,"id":221505634,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTUwNTYzNA==","diff_hunk":"@@ -241,70 +241,88 @@ func TestInitContextRequire(t *testing.T) {\n \t})\n }\n \n-func TestInitContextOpen(t *testing.T) {\n+func createFile(t *testing.T, file string, content string, binary bool) (*BundleInstance, error) {\n \tfs := afero.NewMemMapFs()\n \tassert.NoError(t, fs.MkdirAll(\"/path/to\", 0755))\n-\tassert.NoError(t, afero.WriteFile(fs, \"/path/to/file.txt\", []byte(\"hi!\"), 0644))\n+\tassert.NoError(t, afero.WriteFile(fs, \"/path/to/\"+file, []byte(content), 0644))\n \n-\ttestdata := map[string]string{\n-\t\t\"Absolute\": \"/path/to/file.txt\",\n-\t\t\"Relative\": \"./file.txt\",\n+\tafero.WriteFile(fs, \"/path/to/\"+file, []byte(content), 0644)\n+\tbinaryArg := \"\"\n+\tif binary {\n+\t\tbinaryArg = \",\\\"b\\\"\"\n \t}\n-\tfor name, loadPath := range testdata {\n-\t\tt.Run(name, func(t *testing.T) {\n-\t\t\tb, err := NewBundle(&lib.SourceData{\n-\t\t\t\tFilename: \"/path/to/script.js\",\n-\t\t\t\tData: []byte(fmt.Sprintf(`\n-\t\t\t\texport let data = open(\"%s\");\n+\n+\tb, err := NewBundle(&lib.SourceData{\n+\t\tFilename: \"/path/to/script.js\",\n+\t\tData: []byte(fmt.Sprintf(`\n+\t\t\t\texport let data = open(\"/path/to/%s\"%s);\n \t\t\t\texport default function() {}","path":"js/initcontext_test.go","position":30,"original_position":30,"commit_id":"490a068b0de3b050a9fc37a8004b476f451229de","original_commit_id":"490a068b0de3b050a9fc37a8004b476f451229de","user":{"login":"na--","id":3336773,"node_id":"MDQ6VXNlcjMzMzY3NzM=","avatar_url":"https://avatars1.githubusercontent.com/u/3336773?v=4","gravatar_id":"","url":"https://api.github.com/users/na--","html_url":"https://github.com/na--","followers_url":"https://api.github.com/users/na--/followers","following_url":"https://api.github.com/users/na--/following{/other_user}","gists_url":"https://api.github.com/users/na--/gists{/gist_id}","starred_url":"https://api.github.com/users/na--/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/na--/subscriptions","organizations_url":"https://api.github.com/users/na--/orgs","repos_url":"https://api.github.com/users/na--/repos","events_url":"https://api.github.com/users/na--/events{/privacy}","received_events_url":"https://api.github.com/users/na--/received_events","type":"User","site_admin":false},"body":"You might want to do something with the data, for example - check if the `data.length` matches the expected size and throw an exception if it doesn't. For strings that should be the number of characters (UTF-16 code points, important since Go uses utf-8), while for binary files it should just be the byte length. ","created_at":"2018-10-01T06:40:02Z","updated_at":"2018-10-01T06:40:50Z","html_url":"https://github.com/loadimpact/k6/pull/787#discussion_r221505634","pull_request_url":"https://api.github.com/repos/loadimpact/k6/pulls/787","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/loadimpact/k6/pulls/comments/221505634"},"html":{"href":"https://github.com/loadimpact/k6/pull/787#discussion_r221505634"},"pull_request":{"href":"https://api.github.com/repos/loadimpact/k6/pulls/787"}}},"pull_request":{"url":"https://api.github.com/repos/loadimpact/k6/pulls/787","id":219146327,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5MTQ2MzI3","html_url":"https://github.com/loadimpact/k6/pull/787","diff_url":"https://github.com/loadimpact/k6/pull/787.diff","patch_url":"https://github.com/loadimpact/k6/pull/787.patch","issue_url":"https://api.github.com/repos/loadimpact/k6/issues/787","number":787,"state":"open","locked":false,"title":"Refactor init context open()","user":{"login":"AndriiChuzhynov","id":8567114,"node_id":"MDQ6VXNlcjg1NjcxMTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/8567114?v=4","gravatar_id":"","url":"https://api.github.com/users/AndriiChuzhynov","html_url":"https://github.com/AndriiChuzhynov","followers_url":"https://api.github.com/users/AndriiChuzhynov/followers","following_url":"https://api.github.com/users/AndriiChuzhynov/following{/other_user}","gists_url":"https://api.github.com/users/AndriiChuzhynov/gists{/gist_id}","starred_url":"https://api.github.com/users/AndriiChuzhynov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndriiChuzhynov/subscriptions","organizations_url":"https://api.github.com/users/AndriiChuzhynov/orgs","repos_url":"https://api.github.com/users/AndriiChuzhynov/repos","events_url":"https://api.github.com/users/AndriiChuzhynov/events{/privacy}","received_events_url":"https://api.github.com/users/AndriiChuzhynov/received_events","type":"User","site_admin":false},"body":"Added few symbols to test data.\r\nRefactored test of open() method\r\nRelated to  #754","created_at":"2018-09-29T12:54:52Z","updated_at":"2018-10-01T06:40:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc039b95a8d96d369e04f36227b44011270df66c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/loadimpact/k6/pulls/787/commits","review_comments_url":"https://api.github.com/repos/loadimpact/k6/pulls/787/comments","review_comment_url":"https://api.github.com/repos/loadimpact/k6/pulls/comments{/number}","comments_url":"https://api.github.com/repos/loadimpact/k6/issues/787/comments","statuses_url":"https://api.github.com/repos/loadimpact/k6/statuses/490a068b0de3b050a9fc37a8004b476f451229de","head":{"label":"AndriiChuzhynov:Test_for_correct_handling_of_UTF-8/ASCII/binary_files_by_open()","ref":"Test_for_correct_handling_of_UTF-8/ASCII/binary_files_by_open()","sha":"490a068b0de3b050a9fc37a8004b476f451229de","user":{"login":"AndriiChuzhynov","id":8567114,"node_id":"MDQ6VXNlcjg1NjcxMTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/8567114?v=4","gravatar_id":"","url":"https://api.github.com/users/AndriiChuzhynov","html_url":"https://github.com/AndriiChuzhynov","followers_url":"https://api.github.com/users/AndriiChuzhynov/followers","following_url":"https://api.github.com/users/AndriiChuzhynov/following{/other_user}","gists_url":"https://api.github.com/users/AndriiChuzhynov/gists{/gist_id}","starred_url":"https://api.github.com/users/AndriiChuzhynov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndriiChuzhynov/subscriptions","organizations_url":"https://api.github.com/users/AndriiChuzhynov/orgs","repos_url":"https://api.github.com/users/AndriiChuzhynov/repos","events_url":"https://api.github.com/users/AndriiChuzhynov/events{/privacy}","received_events_url":"https://api.github.com/users/AndriiChuzhynov/received_events","type":"User","site_admin":false},"repo":{"id":148026119,"node_id":"MDEwOlJlcG9zaXRvcnkxNDgwMjYxMTk=","name":"k6","full_name":"AndriiChuzhynov/k6","private":false,"owner":{"login":"AndriiChuzhynov","id":8567114,"node_id":"MDQ6VXNlcjg1NjcxMTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/8567114?v=4","gravatar_id":"","url":"https://api.github.com/users/AndriiChuzhynov","html_url":"https://github.com/AndriiChuzhynov","followers_url":"https://api.github.com/users/AndriiChuzhynov/followers","following_url":"https://api.github.com/users/AndriiChuzhynov/following{/other_user}","gists_url":"https://api.github.com/users/AndriiChuzhynov/gists{/gist_id}","starred_url":"https://api.github.com/users/AndriiChuzhynov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndriiChuzhynov/subscriptions","organizations_url":"https://api.github.com/users/AndriiChuzhynov/orgs","repos_url":"https://api.github.com/users/AndriiChuzhynov/repos","events_url":"https://api.github.com/users/AndriiChuzhynov/events{/privacy}","received_events_url":"https://api.github.com/users/AndriiChuzhynov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/AndriiChuzhynov/k6","description":"A modern load testing tool, using Go and JavaScript - https://k6.io","fork":true,"url":"https://api.github.com/repos/AndriiChuzhynov/k6","forks_url":"https://api.github.com/repos/AndriiChuzhynov/k6/forks","keys_url":"https://api.github.com/repos/AndriiChuzhynov/k6/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AndriiChuzhynov/k6/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AndriiChuzhynov/k6/teams","hooks_url":"https://api.github.com/repos/AndriiChuzhynov/k6/hooks","issue_events_url":"https://api.github.com/repos/AndriiChuzhynov/k6/issues/events{/number}","events_url":"https://api.github.com/repos/AndriiChuzhynov/k6/events","assignees_url":"https://api.github.com/repos/AndriiChuzhynov/k6/assignees{/user}","branches_url":"https://api.github.com/repos/AndriiChuzhynov/k6/branches{/branch}","tags_url":"https://api.github.com/repos/AndriiChuzhynov/k6/tags","blobs_url":"https://api.github.com/repos/AndriiChuzhynov/k6/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AndriiChuzhynov/k6/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AndriiChuzhynov/k6/git/refs{/sha}","trees_url":"https://api.github.com/repos/AndriiChuzhynov/k6/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AndriiChuzhynov/k6/statuses/{sha}","languages_url":"https://api.github.com/repos/AndriiChuzhynov/k6/languages","stargazers_url":"https://api.github.com/repos/AndriiChuzhynov/k6/stargazers","contributors_url":"https://api.github.com/repos/AndriiChuzhynov/k6/contributors","subscribers_url":"https://api.github.com/repos/AndriiChuzhynov/k6/subscribers","subscription_url":"https://api.github.com/repos/AndriiChuzhynov/k6/subscription","commits_url":"https://api.github.com/repos/AndriiChuzhynov/k6/commits{/sha}","git_commits_url":"https://api.github.com/repos/AndriiChuzhynov/k6/git/commits{/sha}","comments_url":"https://api.github.com/repos/AndriiChuzhynov/k6/comments{/number}","issue_comment_url":"https://api.github.com/repos/AndriiChuzhynov/k6/issues/comments{/number}","contents_url":"https://api.github.com/repos/AndriiChuzhynov/k6/contents/{+path}","compare_url":"https://api.github.com/repos/AndriiChuzhynov/k6/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AndriiChuzhynov/k6/merges","archive_url":"https://api.github.com/repos/AndriiChuzhynov/k6/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AndriiChuzhynov/k6/downloads","issues_url":"https://api.github.com/repos/AndriiChuzhynov/k6/issues{/number}","pulls_url":"https://api.github.com/repos/AndriiChuzhynov/k6/pulls{/number}","milestones_url":"https://api.github.com/repos/AndriiChuzhynov/k6/milestones{/number}","notifications_url":"https://api.github.com/repos/AndriiChuzhynov/k6/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AndriiChuzhynov/k6/labels{/name}","releases_url":"https://api.github.com/repos/AndriiChuzhynov/k6/releases{/id}","deployments_url":"https://api.github.com/repos/AndriiChuzhynov/k6/deployments","created_at":"2018-09-09T13:04:10Z","updated_at":"2018-09-20T19:58:37Z","pushed_at":"2018-09-29T12:34:33Z","git_url":"git://github.com/AndriiChuzhynov/k6.git","ssh_url":"git@github.com:AndriiChuzhynov/k6.git","clone_url":"https://github.com/AndriiChuzhynov/k6.git","svn_url":"https://github.com/AndriiChuzhynov/k6","homepage":"","size":10045,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"loadimpact:master","ref":"master","sha":"ef05dfd0c2a680416db1ad1db3978951d669742e","user":{"login":"loadimpact","id":2271486,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyNzE0ODY=","avatar_url":"https://avatars2.githubusercontent.com/u/2271486?v=4","gravatar_id":"","url":"https://api.github.com/users/loadimpact","html_url":"https://github.com/loadimpact","followers_url":"https://api.github.com/users/loadimpact/followers","following_url":"https://api.github.com/users/loadimpact/following{/other_user}","gists_url":"https://api.github.com/users/loadimpact/gists{/gist_id}","starred_url":"https://api.github.com/users/loadimpact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loadimpact/subscriptions","organizations_url":"https://api.github.com/users/loadimpact/orgs","repos_url":"https://api.github.com/users/loadimpact/repos","events_url":"https://api.github.com/users/loadimpact/events{/privacy}","received_events_url":"https://api.github.com/users/loadimpact/received_events","type":"Organization","site_admin":false},"repo":{"id":54400687,"node_id":"MDEwOlJlcG9zaXRvcnk1NDQwMDY4Nw==","name":"k6","full_name":"loadimpact/k6","private":false,"owner":{"login":"loadimpact","id":2271486,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyNzE0ODY=","avatar_url":"https://avatars2.githubusercontent.com/u/2271486?v=4","gravatar_id":"","url":"https://api.github.com/users/loadimpact","html_url":"https://github.com/loadimpact","followers_url":"https://api.github.com/users/loadimpact/followers","following_url":"https://api.github.com/users/loadimpact/following{/other_user}","gists_url":"https://api.github.com/users/loadimpact/gists{/gist_id}","starred_url":"https://api.github.com/users/loadimpact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loadimpact/subscriptions","organizations_url":"https://api.github.com/users/loadimpact/orgs","repos_url":"https://api.github.com/users/loadimpact/repos","events_url":"https://api.github.com/users/loadimpact/events{/privacy}","received_events_url":"https://api.github.com/users/loadimpact/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/loadimpact/k6","description":"A modern load testing tool, using Go and JavaScript - https://k6.io","fork":false,"url":"https://api.github.com/repos/loadimpact/k6","forks_url":"https://api.github.com/repos/loadimpact/k6/forks","keys_url":"https://api.github.com/repos/loadimpact/k6/keys{/key_id}","collaborators_url":"https://api.github.com/repos/loadimpact/k6/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/loadimpact/k6/teams","hooks_url":"https://api.github.com/repos/loadimpact/k6/hooks","issue_events_url":"https://api.github.com/repos/loadimpact/k6/issues/events{/number}","events_url":"https://api.github.com/repos/loadimpact/k6/events","assignees_url":"https://api.github.com/repos/loadimpact/k6/assignees{/user}","branches_url":"https://api.github.com/repos/loadimpact/k6/branches{/branch}","tags_url":"https://api.github.com/repos/loadimpact/k6/tags","blobs_url":"https://api.github.com/repos/loadimpact/k6/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/loadimpact/k6/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/loadimpact/k6/git/refs{/sha}","trees_url":"https://api.github.com/repos/loadimpact/k6/git/trees{/sha}","statuses_url":"https://api.github.com/repos/loadimpact/k6/statuses/{sha}","languages_url":"https://api.github.com/repos/loadimpact/k6/languages","stargazers_url":"https://api.github.com/repos/loadimpact/k6/stargazers","contributors_url":"https://api.github.com/repos/loadimpact/k6/contributors","subscribers_url":"https://api.github.com/repos/loadimpact/k6/subscribers","subscription_url":"https://api.github.com/repos/loadimpact/k6/subscription","commits_url":"https://api.github.com/repos/loadimpact/k6/commits{/sha}","git_commits_url":"https://api.github.com/repos/loadimpact/k6/git/commits{/sha}","comments_url":"https://api.github.com/repos/loadimpact/k6/comments{/number}","issue_comment_url":"https://api.github.com/repos/loadimpact/k6/issues/comments{/number}","contents_url":"https://api.github.com/repos/loadimpact/k6/contents/{+path}","compare_url":"https://api.github.com/repos/loadimpact/k6/compare/{base}...{head}","merges_url":"https://api.github.com/repos/loadimpact/k6/merges","archive_url":"https://api.github.com/repos/loadimpact/k6/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/loadimpact/k6/downloads","issues_url":"https://api.github.com/repos/loadimpact/k6/issues{/number}","pulls_url":"https://api.github.com/repos/loadimpact/k6/pulls{/number}","milestones_url":"https://api.github.com/repos/loadimpact/k6/milestones{/number}","notifications_url":"https://api.github.com/repos/loadimpact/k6/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/loadimpact/k6/labels{/name}","releases_url":"https://api.github.com/repos/loadimpact/k6/releases{/id}","deployments_url":"https://api.github.com/repos/loadimpact/k6/deployments","created_at":"2016-03-21T15:30:24Z","updated_at":"2018-10-01T05:39:40Z","pushed_at":"2018-10-01T05:39:45Z","git_url":"git://github.com/loadimpact/k6.git","ssh_url":"git@github.com:loadimpact/k6.git","clone_url":"https://github.com/loadimpact/k6.git","svn_url":"https://github.com/loadimpact/k6","homepage":"","size":10002,"stargazers_count":4235,"watchers_count":4235,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":189,"mirror_url":null,"archived":false,"open_issues_count":132,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":189,"open_issues":132,"watchers":4235,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/loadimpact/k6/pulls/787"},"html":{"href":"https://github.com/loadimpact/k6/pull/787"},"issue":{"href":"https://api.github.com/repos/loadimpact/k6/issues/787"},"comments":{"href":"https://api.github.com/repos/loadimpact/k6/issues/787/comments"},"review_comments":{"href":"https://api.github.com/repos/loadimpact/k6/pulls/787/comments"},"review_comment":{"href":"https://api.github.com/repos/loadimpact/k6/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/loadimpact/k6/pulls/787/commits"},"statuses":{"href":"https://api.github.com/repos/loadimpact/k6/statuses/490a068b0de3b050a9fc37a8004b476f451229de"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"na--"}}