Skip to content

Object.freeze(Object.prototype) crashing vitest process #798

Closed

Description

@dbauszus-glx

Describe the bug

We have a module in which we freeze the Object.prototype for security reasons.

We can test this module with the vitest cli. If however we use the vitest extension the process crashes with following TypeError: Cannot assign to read only property 'constructor' of object '#<Object>'

Is there a reason why the vitest extension is trying to modify the constructor property?

Expected behavior

The vitest extension should be able to test a module which freezes the Object.prototype.

Reproduction

Use Object.freeze(Object.prototype) in a module and test this with the vitest extension.

We discovered the issue in this PR. GEOLYTIX/xyz#2883

Image

Output

There is nothing in the output the process crashes.

Extension Version

1.50.8

Vitest Version

4.1.10

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions