Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The "options.context" property must be an vm.Context. #33

Open
unional opened this issue Feb 19, 2024 · 1 comment
Open

The "options.context" property must be an vm.Context. #33

unional opened this issue Feb 19, 2024 · 1 comment

Comments

@unional
Copy link

unional commented Feb 19, 2024

TypeError: The "options.context" property must be an vm.Context. Received an instance of Object

          at Runtime.loadEsmModule (../../node_modules/.pnpm/jest-runtime@29.7.0/node_modules/jest-runtime/build/index.js:516:20) 

Getting this error when using NODE_OPTIONS=--experimental-vm-modules.

It could be a non-issue as electron doesn't really support ESM yet (although latest version starts supporting it),
but opening this issue for reference.

@kayahr
Copy link
Owner

kayahr commented Aug 20, 2024

I don't think that it will magically work out of the box by just upgrading Electron in the future. jest-electron-runner is pretty much tied to CJS require calls and I don't think I will be able to fix this. But pull requests are always welcome.

Actually for ESM projects I strongly recommend abandoning Jest and jest-electron-runner and switch to Vitest and use its Browser Mode to run tests in a headless Chromium.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants