{"action":"created","issue":{"url":"https://api.github.com/repos/jasmine/jasmine/issues/1403","repository_url":"https://api.github.com/repos/jasmine/jasmine","labels_url":"https://api.github.com/repos/jasmine/jasmine/issues/1403/labels{/name}","comments_url":"https://api.github.com/repos/jasmine/jasmine/issues/1403/comments","events_url":"https://api.github.com/repos/jasmine/jasmine/issues/1403/events","html_url":"https://github.com/jasmine/jasmine/issues/1403","id":247168220,"number":1403,"title":"saveArgumentsByValue() saves primitive arguments as Object({ })","user":{"login":"kapil-ms","id":20193720,"avatar_url":"https://avatars0.githubusercontent.com/u/20193720?v=4","gravatar_id":"","url":"https://api.github.com/users/kapil-ms","html_url":"https://github.com/kapil-ms","followers_url":"https://api.github.com/users/kapil-ms/followers","following_url":"https://api.github.com/users/kapil-ms/following{/other_user}","gists_url":"https://api.github.com/users/kapil-ms/gists{/gist_id}","starred_url":"https://api.github.com/users/kapil-ms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kapil-ms/subscriptions","organizations_url":"https://api.github.com/users/kapil-ms/orgs","repos_url":"https://api.github.com/users/kapil-ms/repos","events_url":"https://api.github.com/users/kapil-ms/events{/privacy}","received_events_url":"https://api.github.com/users/kapil-ms/received_events","type":"User","site_admin":false},"labels":[{"id":42323,"url":"https://api.github.com/repos/jasmine/jasmine/labels/bug","name":"bug","color":"d41313","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-08-01T18:58:55Z","updated_at":"2017-08-01T19:28:32Z","closed_at":null,"body":"<!--- Provide a general summary of the issue in the Title above -->\r\n\r\n## Expected Behavior\r\nsaveArgumentsByValue() should save arguments of primitive types (passed by value) as it is.\r\n\r\n## Current Behavior\r\nsaveArgumentsByValue() saves arguments of primitive types (passed by value) as Object({ })\r\n\r\n## Suite that reproduces the behavior (for bugs)\r\n```javascript\r\nit('test', () => {\r\n            let service = { test: (x, y)=> { x.key = y; } };\r\n            let testSpy = spyOn(service, 'test').and.callThrough();\r\n            testSpy.calls.saveArgumentsByValue();\r\n            let a = { key: 1 };\r\n            let b = 2;\r\n            service.test(a, b);\r\n            expect(testSpy).toHaveBeenCalledWith(jasmine.objectContaining({ key: 1 }), 2);\r\n        });\r\n```\r\n```\r\nMessage:\r\n    Expected spy test to have been called with [ <jasmine.objectContaining(Object({ key: 1 }))>, 2 ] but actual calls were [ Object({ key: 1 }), Object({  }) ].\r\n```\r\n\r\nI went ahead and tried to run the condition check at https://github.com/jasmine/jasmine/blob/9cb2f06aa665870dbd5df5fd58a35863738961b3/src/core/CallTracker.js#L14. I got the following results, so this check would always be true, which is incorrect.\r\n```\r\nλ node                                          \r\n> Object.prototype.toString.apply(1)            \r\n'[object Number]'                               \r\n> Object.prototype.toString.apply('adad')       \r\n'[object String]'                                \r\n> Object.prototype.toString.apply({a:1})        \r\n'[object Object]'                              \r\n> Object.prototype.toString.apply(new Date())   \r\n'[object Date]'                                 \r\n```\r\n\r\n## Your Environment\r\n* Version used: 2.6.0\r\n* Environment name and version (e.g. Chrome 39, node.js 5.4): node 8.2.1\r\n* Operating System and version (desktop or mobile): Windows 10\r\n"},"comment":{"url":"https://api.github.com/repos/jasmine/jasmine/issues/comments/319472003","html_url":"https://github.com/jasmine/jasmine/issues/1403#issuecomment-319472003","issue_url":"https://api.github.com/repos/jasmine/jasmine/issues/1403","id":319472003,"user":{"login":"slackersoft","id":512724,"avatar_url":"https://avatars0.githubusercontent.com/u/512724?v=4","gravatar_id":"","url":"https://api.github.com/users/slackersoft","html_url":"https://github.com/slackersoft","followers_url":"https://api.github.com/users/slackersoft/followers","following_url":"https://api.github.com/users/slackersoft/following{/other_user}","gists_url":"https://api.github.com/users/slackersoft/gists{/gist_id}","starred_url":"https://api.github.com/users/slackersoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slackersoft/subscriptions","organizations_url":"https://api.github.com/users/slackersoft/orgs","repos_url":"https://api.github.com/users/slackersoft/repos","events_url":"https://api.github.com/users/slackersoft/events{/privacy}","received_events_url":"https://api.github.com/users/slackersoft/received_events","type":"User","site_admin":false},"created_at":"2017-08-01T19:28:32Z","updated_at":"2017-08-01T19:28:32Z","body":"This definitely sounds like a bug. Because `Date`s are mutable, I think it make sense to find some way to clone them properly, but numbers and strings are probably find to copy the reference. I'd be happy to review a pull request to fix this."}}
{"actor":{"display_login":"slackersoft"}}