You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just found a bug in my code caused by this unexpected behavior of fixture.load:
let fixtureObj = fixture.load('myfixture.json')
console.log(fixtureObj.testVal) // -> prints "undefined" (which is expected)
fixtureObj.testVal = 'foo'
fixtureObj = fixture.load('myfixture.json')
console.log(fixtureObj.testVal) // -> prints "foo" (which is not expected)
It seems that fixture.load returns the same instance of the object on each call, and thus subsequent calls will see any mutations on the object.
Would it be possible to deep clone the object before returning it via fixture.load? This would eliminate the issues I've seen.
The text was updated successfully, but these errors were encountered:
I just found a bug in my code caused by this unexpected behavior of
fixture.load
:It seems that
fixture.load
returns the same instance of the object on each call, and thus subsequent calls will see any mutations on the object.Would it be possible to deep clone the object before returning it via
fixture.load
? This would eliminate the issues I've seen.The text was updated successfully, but these errors were encountered: