kayahr / jest-electron-runner

Custom test runner for Jest that allows tests to be run in Electron environment
https://www.npmjs.com/package/@kayahr/jest-electron-runner
MIT License
20 stars 4 forks source link

Error message with angular-preset "The V8 platform used by this instance of Node does not support creating Workers" #4

Closed tentone closed 2 years ago

tentone commented 2 years ago

Hello

Thanks a lot for creating this fork of the jest-electron-runner, has been quite a good experience for bringing some of our Angular client code to the test suite.

We are currently having an issue after updating to latest version of Jest (28) and introducing "angular-present" into the project.

The V8 platform used by this instance of Node does not support creating Workers

After searching a while this is a common problem with node/electron apps (https://github.com/electron/electron/issues/18540) that could be solved by providing a environment variable NODE_OPTIONS="--experimental-worker".

After setting the environment var im still getting the error not sure if the library is picking the variable.

tentone commented 2 years ago

After digging a bit further the problem was caused by the introduction of the "jest-angular-preset" that seems to try to launch workers.

I made a simpler test without browser deps that imports the "@angular/compiler" library and seems to work correctly on node but fails with the electron based environment.

Dont think that its possible to fix this for now. I will keep digging probably best to ditch the angular-preset and figure my own config to run the environment. https://github.com/electron/electron/issues/20550

aasdad b

kayahr commented 2 years ago

If jest-angular-preset is meant to be used in a Node environment and does fancy stuff (Angular always does fancy complicated stuff, one reason why I don't like it...) then so be it. I guess you have to split your tests into two groups then. Angular tests must run in a node-runner, other tests can run in electron-runner (or both).

I'm closing this issue because I probably won't/can't fix it anyway,

tentone commented 2 years ago

Agree, nothing that can be done here since it is a limitation from electron to acess the node based workers.

Thanks a lot for the great project!