{"id":13847224,"url":"https://github.com/privatenumber/instant-mocha","last_synced_at":"2025-04-05T10:07:52.608Z","repository":{"id":45273050,"uuid":"361339890","full_name":"privatenumber/instant-mocha","owner":"privatenumber","description":"☕️ Build tests with Webpack and run with Mocha in one command","archived":false,"fork":false,"pushed_at":"2024-12-08T03:15:34.000Z","size":507,"stargazers_count":48,"open_issues_count":3,"forks_count":7,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-29T09:08:45.337Z","etag":null,"topics":["binary","cli","mocha","runner","testing","watch","webpack"],"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/privatenumber.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},"funding":{"github":"privatenumber"}},"created_at":"2021-04-25T05:34:17.000Z","updated_at":"2024-12-08T03:15:38.000Z","dependencies_parsed_at":"2024-01-15T20:51:22.709Z","dependency_job_id":"63b56241-6433-4e8d-848a-7eae2c50e5db","html_url":"https://github.com/privatenumber/instant-mocha","commit_stats":{"total_commits":71,"total_committers":6,"mean_commits":"11.833333333333334","dds":0.07042253521126762,"last_synced_commit":"032c5fbe0b721e4071341eef91cac00092696558"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Finstant-mocha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Finstant-mocha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Finstant-mocha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Finstant-mocha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/privatenumber","download_url":"https://codeload.github.com/privatenumber/instant-mocha/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247318744,"owners_count":20919484,"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":["binary","cli","mocha","runner","testing","watch","webpack"],"created_at":"2024-08-04T18:01:13.764Z","updated_at":"2025-04-05T10:07:52.581Z","avatar_url":"https://github.com/privatenumber.png","language":"TypeScript","funding_links":["https://github.com/sponsors/privatenumber","https://github.com/sponsors/privatenumber/sponsorships?tier_id=398771","https://github.com/sponsors/privatenumber/sponsorships?tier_id=416984"],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\".github/logo.svg\" width=\"112px\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003e\n  instant-mocha\n  \u003cbr\u003e\n  \u003ca href=\"https://npm.im/instant-mocha\"\u003e\u003cimg src=\"https://badgen.net/npm/v/instant-mocha\"\u003e\u003c/a\u003e \u003ca href=\"https://npm.im/instant-mocha\"\u003e\u003cimg src=\"https://badgen.net/npm/dm/instant-mocha\"\u003e\u003c/a\u003e \u003ca href=\"https://packagephobia.now.sh/result?p=instant-mocha\"\u003e\u003cimg src=\"https://packagephobia.now.sh/badge?p=instant-mocha\"\u003e\u003c/a\u003e\n\u003c/h1\u003e\n\nBuild tests with Webpack and run them with Mocha in one command\n\n### Features\n- Source-map support\n- Builds and runs in-memory\n- Inherits Mocha CLI\n- Supports Webpack 5 + Mocha 8, 9, \u0026 10\n\n_How does it compare to [mocha-webpack](https://github.com/zinserjan/mocha-webpack) / [mochapack](https://github.com/sysgears/mochapack)?_ Answered in the [FAQ](#how-is-it-different-from-mocha-webpack-or-its-fork-mochapack).\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://github.com/sponsors/privatenumber/sponsorships?tier_id=398771\"\u003e\u003cimg width=\"412\" src=\"https://raw.githubusercontent.com/privatenumber/sponsors/master/banners/assets/donate.webp\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://github.com/sponsors/privatenumber/sponsorships?tier_id=416984\"\u003e\u003cimg width=\"412\" src=\"https://raw.githubusercontent.com/privatenumber/sponsors/master/banners/assets/sponsor.webp\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## 🚀 Install\n```sh\nnpm i -D mocha webpack instant-mocha\n```\n\nNote: `webpack` and `mocha` are peer-dependencies so you can provide any version\n\n## 👨‍🏫 Usage\n```sh\ninstant-mocha [test paths/globs...]\n```\n\nYou can either use [`npx`](https://www.npmjs.com/package/npx) (eg. `npx instant-mocha ...`) or add it to [`package.json` scripts](https://nodejs.dev/learn/the-package-json-guide) (eg. `npm test`) to invoke it. \n\n### Options\n#### -w, --watch\nWatch mode. Re-compiles the Webpack build and re-run tests on file-changes.\n\n#### --webpack-config\nDefault: `webpack.config.js`\n\nPath to the Webpack config.\n\n#### Supports all options from Mocha CLI\nFor more info, run:\n```sh\ninstant-mocha --help\n```\n\n### Example\n```sh\ninstant-mocha --webpack-config webpack.config.js --require setup.js 'tests/*.spec.js'\n```\n- Load Webpack config from `webpack.config.js`\n- Load setup script from `setup.js`. _Note, this is not apart of the build and is loaded directly from Node.js_\n- Find and run tests that matches glob `tests/*.spec.js`\n\n## 💁‍♀️ FAQ\n\n### How do I enable source-maps?\nSet [`devtool: 'source-map'`](https://webpack.js.org/configuration/devtool/) in your Webpack config.\n\n### How do I add a progress bar?\nAdd [webpackbar](https://github.com/unjs/webpackbar) to your Webpack config.\n\n### Are `node_modules` automatically externalized?\nThey can't be automatically externalized because it's possible some dependencies require bundling or pre-processing. For example, packages in [ESM format](https://nodejs.org/api/esm.html) or deep-dependencies that are stubbed for testing.\n\nIt's recommended to externalize what you can in your [Webpack config](https://webpack.js.org/configuration/externals/) to speed up the build though. Consider using [`webpack-node-externals`](https://github.com/liady/webpack-node-externals) to do this.\n\n### How is it different from [mocha-webpack](https://github.com/zinserjan/mocha-webpack) or its fork [mochapack](https://github.com/sysgears/mochapack)?\n\n_First of all, major thanks to [mocha-webpack](https://github.com/zinserjan/mocha-webpack) for the original implementation and serving the community._\n\nThis project was created from scratch because `mocha-webpack` is no longer maintained and doesn't have Webpack 5 support.\n\nSome notable improvements include:\n- **Written in TypeScript** whereas `mocha-webpack` uses [Flow](https://github.com/facebook/flow).\n- **Doesn't re-implement another file-watching mechanism** Relies on Webpack's watcher instead.\n- **Loosely coupled with Mocha and Webpack** The API surface used is very narrow so it works with most versions, (eg. Webpack 4 \u0026 5).\n- **Correct exit codes** Mocha and `mocha-webpack` returns the number of failed tests as the exit code. instant-mocha only uses exit code `1` for any test failures as per [Bash convention](https://tldp.org/LDP/abs/html/exitcodes.html).\n- **Smaller size** Reuses a lot from Webpack \u0026 Mocha so it's much lighter: [![instant-mocha install size](https://packagephobia.now.sh/badge?p=instant-mocha)](https://packagephobia.now.sh/result?p=instant-mocha) vs [![mocha-webpack install size](https://packagephobia.now.sh/badge?p=mocha-webpack)](https://packagephobia.now.sh/result?p=mocha-webpack)\n\n## Sponsors\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://github.com/sponsors/privatenumber\"\u003e\n\t\t\u003cimg src=\"https://cdn.jsdelivr.net/gh/privatenumber/sponsors/sponsorkit/sponsors.svg\"\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprivatenumber%2Finstant-mocha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprivatenumber%2Finstant-mocha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprivatenumber%2Finstant-mocha/lists"}