Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 1.13 KB

README.md

File metadata and controls

34 lines (25 loc) · 1.13 KB

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