easy-fix icon indicating copy to clipboard operation
easy-fix copied to clipboard

Mutation of arguments between function call and resolution causes inconsistent callArgs

Open heneryville opened this issue 7 years ago • 0 comments

Let's say there is a function F(x) such that x is an object, and freturns a Promise. If inside of f, x is mutated, such as via x.a = 'blah', then the arguments that get serialized to the mock file will include a: "blah". Instead, the arguments to f should be snapshotted at the time that the function is called, and what is serialized to the mock file should not reflect later mutations.

https://github.com/walmartlabs/easy-fix/blob/master/index.js#L126

heneryville avatar Apr 02 '18 20:04 heneryville