{"id":23938087,"url":"https://github.com/visvirial/jest-webworker","last_synced_at":"2026-05-07T00:36:20.675Z","repository":{"id":57280555,"uuid":"371705591","full_name":"visvirial/jest-webworker","owner":"visvirial","description":"WebPack's \"worker-loader\"-compliant Jest transformer","archived":false,"fork":false,"pushed_at":"2021-06-01T05:56:46.000Z","size":198,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T03:42:49.867Z","etag":null,"topics":["jest","webpack","webworker","worker-loader"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/visvirial.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}},"created_at":"2021-05-28T13:13:33.000Z","updated_at":"2021-06-01T05:56:48.000Z","dependencies_parsed_at":"2022-09-19T15:51:39.758Z","dependency_job_id":null,"html_url":"https://github.com/visvirial/jest-webworker","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/visvirial/jest-webworker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visvirial%2Fjest-webworker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visvirial%2Fjest-webworker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visvirial%2Fjest-webworker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visvirial%2Fjest-webworker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/visvirial","download_url":"https://codeload.github.com/visvirial/jest-webworker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visvirial%2Fjest-webworker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271767966,"owners_count":24817589,"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","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["jest","webpack","webworker","worker-loader"],"created_at":"2025-01-06T02:18:35.446Z","updated_at":"2026-05-07T00:36:20.648Z","avatar_url":"https://github.com/visvirial.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"jest-webworker: WebPack's \"worker-loader\"-compliant Jest transformer\n====================================================================\n\n[![Node.js CI](https://github.com/visvirial/jest-webworker/actions/workflows/node.js.yml/badge.svg)](https://github.com/visvirial/jest-webworker/actions/workflows/node.js.yml)\n\n⚠WARNING⚠: This package is currently experimental. Please avoid using it in production.\n\nA Jest transformer which can execute WebWorker codes that uses WebPack's\n[worker-loader](https://github.com/webpack-contrib/worker-loader).\n\nThis is an alternative implementation of [workerloader-jest-transformer](https://github.com/astagi/workerloader-jest-transformer).\nThis library aims to enable WebWorker codes run in parallel in Jest environments (where *workerloader-jest-transformer* cannot).\n\nInstall\n-------\n\n```bash\n$ npm install -D jest-webworker\n```\n\nUsage\n-----\n\n1. Add `jest-webworker/@types` to `compilerOptions.typeRoots` in your `tsconfig.json`.\n1. Rename your worker source file to `*.worker.ts`.\n1. Change your `import` statement in your worker launching code as below:\n```ts\nimport HogeWorker from './hoge.worker.ts';\n```\nNote: please avoid using `worker-loader!` prefix since it cannot be recognized by Jest.\n1. Add the following comment between your `import` statements and source code body:\n```ts\n/* __JEST_WEBWORKER_SEPARATOR__ */\n```\n1. Run jest and enjoy testing!\n\nExamples\n--------\n\nPlease take a look at test codes inside the [./\\_\\_tests\\_\\_](./__tests__) directory for more detailed usage.\n\nMotivation\n----------\n\nThe [workerloader-jest-transformer](https://github.com/astagi/workerloader-jest-transformer) package is considerably\na nobel implementation of WebPack's WebWorker transformer, however,\n[workerloader-jest-transformer](https://github.com/astagi/workerloader-jest-transformer)\nlaunches Workers in the main Node.js thread and hence cannot be parallelized in practice.\nThis will reduce the test performance for WebWorker codes which launches multiple WebWorker threads and process data in parallel.\n\nThis package, on the other hand, launches Worker threads using Node.js's `worker_threads` feature and\nexecutes WebWorkers in a thread other than the main thread.\n\nThe performance improvements can be measured by running the `fibonacci` test\n(computes the 40-th fibonacci number using recurrsion = slow implementation, in purpose).\n\n```bash\n$ npm t fibo \n\n\u003e jest-webworker@0.0.1 test\n\u003e jest \"fibo\"\n\n PASS  __tests__/fibonacci.test.ts (11.077 s)\n  FibonacciWorker\n    ✓ can execute in parallel (2276 ms)\n    ✓ can execute in serial (7882 ms)\n\nTest Suites: 1 passed, 1 total\nTests:       2 passed, 2 total\nSnapshots:   0 total\nTime:        11.131 s\nRan all test suites matching /fibo/i.\n```\n\nOn my desktop machine with 4 CPU cores can execute the test laughly x3.46 faster than the serialized case (see above).\n\nContributiion\n-------------\n\nAny contribution, including bug reports, comments, suggenstions and / or  pull requests are acceptable 🍻.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisvirial%2Fjest-webworker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvisvirial%2Fjest-webworker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisvirial%2Fjest-webworker/lists"}