Environment
$ node -v
v20.13.1
Reproduction
const [a, b, c] = [Symbol("a"), Symbol("b"), Symbol("c")];
const result = defu({ [a]: "a", [c]: ["a", "b"] }, { [a]: "bbb", [b]: "c", [c]: ["c", "d"] });
expect(result).toEqual({ [a]: "a", [b]: "c", [c]: ["a", "b", "c", "d"] });
AssertionError: expected { [Symbol(a)]: 'bbb', …(2) } to deeply equal { [Symbol(a)]: 'a', …(2) }
- Expected
+ Received
Object {
- Symbol(a): "a",
+ Symbol(a): "bbb",
Symbol(b): "c",
Symbol(c): Array [
- "a",
- "b",
"c",
"d",
],
}
Describe the bug
Symbol keys are not iterated over the base object, but the other objects use Object.assign which does copy symbol keys.
Additional context
No response
Logs
Environment
$ node -v
v20.13.1
Reproduction
AssertionError: expected { [Symbol(a)]: 'bbb', …(2) } to deeply equal { [Symbol(a)]: 'a', …(2) } - Expected + Received Object { - Symbol(a): "a", + Symbol(a): "bbb", Symbol(b): "c", Symbol(c): Array [ - "a", - "b", "c", "d", ], }Describe the bug
Symbol keys are not iterated over the base object, but the other objects use
Object.assignwhich does copy symbol keys.Additional context
No response
Logs