Skip to content

williamluke4/napi-jest-repoduction

Repository files navigation

NAPI-RS with Jest ENV Vars Reproduction

This issue seems to arise from this part of the jest code.

Jest is mocking the process, which means that any changes to the env in a jest test environment (using something like process.env.TEST="fff") will not get propagated to the actual process environment variables. Thus the rust side never receives them.

Relevant Files

Requirements

How to Reproduce

git clone https://github.com/williamluke4/napi-jest-repoduction
cd napi-jest-repoduction
yarn build 
# This will fail
jest  
# This will now work after the patch
ts-node ./patchJest.ts && jest
# This will also pass as it is not jest 
node ./env-test.js
# You can also revert the patch using 
ts-node ./patchJest.ts unpatch

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published