{"id":15416796,"url":"https://github.com/filipoliko/jest-worker-threads-share-env","last_synced_at":"2025-04-05T05:27:08.504Z","repository":{"id":128720169,"uuid":"356284109","full_name":"Filipoliko/jest-worker-threads-share-env","owner":"Filipoliko","description":null,"archived":false,"fork":false,"pushed_at":"2021-04-12T07:12:46.000Z","size":48,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T13:22:16.522Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Filipoliko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-09T13:39:41.000Z","updated_at":"2021-04-12T07:12:48.000Z","dependencies_parsed_at":"2023-06-05T04:15:20.103Z","dependency_job_id":null,"html_url":"https://github.com/Filipoliko/jest-worker-threads-share-env","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"f4cae9ba571bcec659c9c2ce71cc783b33895cfc"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Filipoliko%2Fjest-worker-threads-share-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Filipoliko%2Fjest-worker-threads-share-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Filipoliko%2Fjest-worker-threads-share-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Filipoliko%2Fjest-worker-threads-share-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Filipoliko","download_url":"https://codeload.github.com/Filipoliko/jest-worker-threads-share-env/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247291771,"owners_count":20914924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T17:13:51.527Z","updated_at":"2025-04-05T05:27:08.475Z","avatar_url":"https://github.com/Filipoliko.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jest Worker Threads Share Env Test\n\nThis repo shows, that `SHARE_ENV` in `worker_threads` does not work share the environment variables when running tests in Jest environment.\n\n## Installation\n\n```bash\nnpm install\n```\n\n## Run Test\n\nScenario:\n- Init worker (`worker.js`) with option `env: SHARE_ENV` ([docs](https://nodejs.org/docs/latest-v14.x/api/worker_threads.html#worker_threads_worker_share_env))\n- Worker sets environment variable `JEST_SHARE_ENV` to `foo`\n\nNow we expect, that thanks to using `SHARE_ENV`, the environment variable would also propagate to master process. This does not work when running tests in Jest environment.\n\nTo run both, Node and Jest version of the test, use the following command:\n\n```bash\nnpm test\n```\n\nTo run the Node version only:\n\n```bash\nnode assert.js\n```\n\nTo run the Jest version only:\n\n```bash\nnpx jest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilipoliko%2Fjest-worker-threads-share-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffilipoliko%2Fjest-worker-threads-share-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilipoliko%2Fjest-worker-threads-share-env/lists"}