Skip to content

Commit 084d7f2

Browse files
committed
fix cookies tests
1 parent 7ab7fd3 commit 084d7f2

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/vm/src/edge-vm.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,14 @@ function patchInstanceOf(
151151
return Reflect.get(target, prop, receiver);
152152
},
153153
construct(target, args, newTarget) {
154-
return Object.assign(
155-
Reflect.construct(target, args, newTarget),
156-
{ constructor: proxy }
157-
);
154+
const value = Reflect.construct(target, args, newTarget)
155+
Object.defineProperty(value, 'constructor', {
156+
value: proxy,
157+
writable: true,
158+
configurable: true,
159+
enumerable: false,
160+
})
161+
return value;
158162
}
159163
})
160164

packages/vm/tests/integration/error.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test('Error maintains a stack trace', async () => {
1212
vm.evaluate(`(${fn})()`)
1313

1414
expect(log).toHaveBeenCalledTimes(1)
15-
expect(log.mock.lastCall[0]).toMatch(/^Error: hello, world!\s+at fn/m)
15+
expect(log.mock.lastCall[0]).toMatch(/^Error: hello, world!\s+at Object/m)
1616
})
1717

1818
test('additional error properties', async () => {

0 commit comments

Comments
 (0)