Skip to content

Captured arguments are changed by object changes #218

@namse

Description

@namse

I found that captured action(or method)'s arguments are changed when I change the object that I passed as argument.

for example,

class A {
  foo(b) {
  }
}

const mockedA = mock(A);
const instanceA = instance(mockedA);
const argument = {};
instanceA.foo(argument);
argument.c = 5;
const [firstArg] = capture(mockedFoo.foo).last();
console.log(firstArg) // print { c: 5 } ! I expected it prints { } because I pass {}.

I guess captured argument should be serialized

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions