{"id":21855030,"url":"https://github.com/wix-incubator/esbuild-jest-cli","last_synced_at":"2025-04-14T18:07:15.253Z","repository":{"id":66227067,"uuid":"592273922","full_name":"wix-incubator/esbuild-jest-cli","owner":"wix-incubator","description":"ESBuild tool to bundle Jest test projects","archived":false,"fork":false,"pushed_at":"2025-03-31T14:28:21.000Z","size":96,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-04-14T18:07:05.946Z","etag":null,"topics":["esbuild","esbuild-plugin","jest","jest-transformer"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/wix-incubator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-01-23T11:23:34.000Z","updated_at":"2025-03-31T14:26:51.000Z","dependencies_parsed_at":"2023-12-07T18:31:30.378Z","dependency_job_id":"14589ca7-d2f1-48aa-9573-b0548aa58fa5","html_url":"https://github.com/wix-incubator/esbuild-jest-cli","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wix-incubator%2Fesbuild-jest-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wix-incubator%2Fesbuild-jest-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wix-incubator%2Fesbuild-jest-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wix-incubator%2Fesbuild-jest-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wix-incubator","download_url":"https://codeload.github.com/wix-incubator/esbuild-jest-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248933338,"owners_count":21185460,"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":["esbuild","esbuild-plugin","jest","jest-transformer"],"created_at":"2024-11-28T02:13:03.004Z","updated_at":"2025-04-14T18:07:15.232Z","avatar_url":"https://github.com/wix-incubator.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \n![esbuild-jest-cli](images/logo.svg)\n\n[![npm version](https://badge.fury.io/js/esbuild-jest-cli.svg)](https://badge.fury.io/js/esbuild-jest-cli)\n[![CI](https://github.com/wix-incubator/esbuild-jest-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/wix-incubator/esbuild-jest-cli/actions/workflows/ci.yml)\n\n\u003c/div\u003e\n\n`esbuild-jest-cli` is a CLI tool to bundle Jest tests with `esbuild` for faster or lighter test execution, e.g.:\n\n```bash\nesbuild-jest -c jest-custom.config.js --maxWorkers=2\n\n# ls .bundle/**\n# .bundle/chunk-ZEPWVVN4.js\n# .bundle/tests/first.test.js\n# .bundle/tests/second.test.js\n```\n\nIt can handle various Jest configurations and supports external modules.\n\n* **Supported Jest versions:** 27.x – 29.x\n* **Supported Node.js versions:** 14.x and higher\n\nTable of Contents\n-----------------\n\n*   [Installation](#installation)\n*   [Usage](#usage)\n*   [Configuration](#configuration)\n*   [Troubleshooting](#troubleshooting)\n*   [Copyright](#copyright)\n\nInstallation\n------------\n\nTo install the CLI, run:\n\n```sh\nnpm install --save-dev esbuild-jest-cli\n```\n\nor with yarn:\n\n```sh\nyarn add --dev esbuild-jest-cli\n```\n\nUsage\n-----\n\nBefore you bundle your tests, make sure you can run them in Jest and that they pass.\n\nTo configure the CLI, create a config file in your project root directory. The possible file names are:\n\n* `.esbuild-jestrc`\n* `.esbuild-jestrc.js`\n* `.esbuild-jestrc.json`,\n\nand any other filenames that follow [cosmiconfig](https://www.npmjs.com/package/cosmiconfig) convention.\n\nOnce the config is ready, run:\n\n```\nnpx esbuild-jest [...optional-jest-arguments]\n```\n\nYou can pass any Jest arguments just like you're running Jest itself.\n\n### Advanced Usage\n\nYou can also use the CLI programmatically – especially useful if you are wrapping it in a custom script:\n\n```js\nimport { build } from 'esbuild-jest-cli';\nimport myPlugin from './my-esbuild-plugin.js';\n\nawait build({\n  esbuild: {\n    outdir: 'dist',\n    sourcemap: true,\n    plugins: [myPlugin()],\n  },\n  package: {\n    name: 'custom-name',\n  },\n});\n```\n\nConfiguration\n-------------\n\nThe configuration file consists of two sections: `esbuild` and `package`, e.g.:\n\n```json\n{\n  \"esbuild\": {\n    \"sourcemap\": true,\n    \"platform\": \"node\",\n    \"outdir\": \".bundle\",\n    \"external\": [\"chalk\"]\n  },\n  \"package\": {\n    \"name\": \"custom-name\"\n  }\n}\n```\n\nIn the `esbuild` section, you can override any `esbuild` option except for a few that are critical for this project to work:\n\n* `bundle: true` – the goal of this project is to bundle so no surprise;\n* `splitting: true` – helps to avoid state bugs in modules;\n* `metafile: true` – helps to generate `jest.config.json` automatically;\n* `outbase` – current working directory is used;\n* `banner` – needed to inject a shim allowing the use of `require()` with ESM.\n\nAny other valid [esbuild configuration options](https://esbuild.github.io/api/#options) are supported as expected.\n\nIn `package` section, you can override fields in the generated `package.json`, such as `name`, `scripts`, etc.\nIt is also possible to pass a function to modify its contents, e.g.:\n\n```js\nmodule.exports = {\n  esbuild: {\n    // ...\n  },\n  package: (p) =\u003e ({\n    ...p,\n    customField: 'customValue',\n  }),\n};\n```\n\nTroubleshooting\n---------------\n\nThis project is currently more of a proof-of-concept, and as such, there might be various issues.\n\nPlease note that the maintainer's time is limited, but feel free to report any problems you encounter via the issue tracker.\n\nCopyright\n---------\n\n© 2023, Wix Incubator. Licensed under [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwix-incubator%2Fesbuild-jest-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwix-incubator%2Fesbuild-jest-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwix-incubator%2Fesbuild-jest-cli/lists"}