{"id":23394329,"url":"https://github.com/arianxdev/hardhat-jest","last_synced_at":"2025-04-11T12:53:39.747Z","repository":{"id":65145152,"uuid":"583671848","full_name":"arianXdev/hardhat-jest","owner":"arianXdev","description":"A Hardhat plugin that allows you to use Jest easily!","archived":false,"fork":false,"pushed_at":"2023-09-16T14:10:01.000Z","size":387,"stargazers_count":10,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T09:11:55.787Z","etag":null,"topics":["blockchain","ethereum","hardhat","hardhat-jest","hardhat-plugin","jest","solidity","web3"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/hardhat-jest","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/arianXdev.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}},"created_at":"2022-12-30T14:20:50.000Z","updated_at":"2025-02-10T10:30:15.000Z","dependencies_parsed_at":"2023-02-09T14:30:40.371Z","dependency_job_id":"6990a9d4-b747-43ba-b971-03fd62dafccc","html_url":"https://github.com/arianXdev/hardhat-jest","commit_stats":null,"previous_names":["arianxdev/hardhat-jest","ryanhosseini/hardhat-jest"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arianXdev%2Fhardhat-jest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arianXdev%2Fhardhat-jest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arianXdev%2Fhardhat-jest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arianXdev%2Fhardhat-jest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arianXdev","download_url":"https://codeload.github.com/arianXdev/hardhat-jest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248403680,"owners_count":21097569,"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":["blockchain","ethereum","hardhat","hardhat-jest","hardhat-plugin","jest","solidity","web3"],"created_at":"2024-12-22T06:14:30.613Z","updated_at":"2025-04-11T12:53:39.719Z","avatar_url":"https://github.com/arianXdev.png","language":"JavaScript","readme":"# hardhat-jest  [![hardhat](https://hardhat.org/buidler-plugin-badge.svg?1)](https://hardhat.org)\n\n\u003ca href=\"https://npmjs.com/package/hardhat-jest\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/npm-CB3837?style=for-the-badge\u0026logo=npm\u0026logoColor=white\"/\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/Solidity-e6e6e6?style=for-the-badge\u0026logo=solidity\u0026logoColor=black\"/\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/Jest-C21325?style=for-the-badge\u0026logo=jest\u0026logoColor=white\"/\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/Ethereum-3C3C3D?style=for-the-badge\u0026logo=Ethereum\u0026logoColor=white\"/\u003e\n\u003c/a\u003e\n\n\u003ca style=\"display: block\" target=\"_blank\" href=\"https://npmjs.com/package/hardhat-jest\"\u003e\u003cimg\n    src=\"hardhat-jest.png\"\n    width='1200\"' /\u003e\u003c/a\u003e\n[![Npm package version](https://badgen.net/npm/v/hardhat-jest)](https://npmjs.com/package/hardhat-jest)\n[![hardhat](https://hardhat.org/buidler-plugin-badge.svg?1)](https://hardhat.org/plugins)\n\n\u003e **Warning**:\n\u003e If you're using \u003c v1.0.6, Please update the package to the latest version ASAP! It may cause errors.\n\nHave you always wanted to use **Jest** instead of Mocha + Chai in your Hardhat Projects? 😉 Good News!\n\n`hardhat-jest` allows you to use **Jest** easily 😃✌️\n\n-   [Installation](#installation)\n-   [Usage](#usage)\n    -   [Options](#options): See all the available options\n    -   [Hardhat Tasks](#hardhat-tasks): See all the Hardhat tasks\n\n## Installation\n\nFirst of all, Make sure that you have `jest` already installed!\n\n**Step 1:** Install the package\n\n```\nnpm i hardhat-jest\n```\n\n**Step 2:** Add to your `hardhat.config.js` file\n\n```\nrequire(\"hardhat-jest\");\n```\n\nIf you're using Typescript, to your `hardhat.config.ts` file\n\n```\nimport \"hardhat-jest\"; // Typescript\n```\n\n## Usage\n\nIt's so easy, You can run your Jest tests by\n\n```\nnpx hardhat jest\n```\n\nYou've been using `npx hardhat test` to run your Mocha tests so far, but NOW you only need to use `jest` instead of `test` and Done!\n\n### Options\n\nIf you're looking to see all the options, you can do it by running `npx hardhat help jest`:\n\n```shell\nUsage: hardhat [GLOBAL OPTIONS] jest [--bail] [--no-compile] [--show-config] [--use-verbose \u003cBOOLEAN\u003e] [--watch] [--watch-all]\n\nOPTIONS:\n\n  --bail       \tStop running tests after the first test failure.\n  --no-compile \tDo NOT compile before running this task.\n  --show-config\tPrint your jest config and then exits.\n  --watch      \tWatch files for changes and rerun tests related to changed files.\n  --watch-all  \tWatch files for changes and rerun all tests.\n  --use-verbose\tDisplay individual test results with the test suite hierarchy. | Enable / Disable [boolean] (default: false)\n\n\njest: Runs Jest tests\n\nFor global options help run: hardhat help\n```\n\nto use options, you can easily run\n\n```shell\nnpx hardhat jest \u003coption-name\u003e\n\n// for example\nnpx hardhat jest --no-compile --watch\n```\n\n#### --use-verbose\n\nIf you want Jest to display individual test results with the test suite hierarchy, you can use `--use-verbose` this way:\n\n```\nnpx hardhat jest --use-verbose true // enables verbose mode only for this project\n\nnpx hardhat jest --use-verbose false // disables verbose mode for the project\n```\n\nRemember: the default value is `false` and disabled, so you must enable it if you want.\n\n#### Specific files to test (testFiles)\n\nIf you want Jest to run only specific files instead of all test files, you can do that by:\n\n```shell\nnpx hardhat jest test/Test3.test.js test/Test4.test.js\n```\n\nNOTE: You must specify files with their full path (from the project root directory)\n\n### Hardhat-tasks\n\nYou can see all the available Hardhat tasks by running `npx hardhat`\n\n```shell\nAVAILABLE TASKS:\n\n  check             \tCheck whatever you need\n  clean             \tClears the cache and deletes all artifacts\n  compile           \tCompiles the entire project, building all artifacts\n  console           \tOpens a hardhat console\n  coverage          \tGenerates a code coverage report for tests\n  flatten           \tFlattens and prints contracts and their dependencies\n  gas-reporter:merge\n  help              \tPrints this message\n\u003e jest                  Runs Jest tests\n  node              \tStarts a JSON-RPC server on top of Hardhat Network\n  run               \tRuns a user-defined script after compiling the project\n  test              \tRuns mocha tests\n  typechain         \tGenerate Typechain typings for compiled contracts\n  verify            \tVerifies contract on Etherscan\n```\n\nand There it is, `jest` task is added successfully! it means that you can run **`npx hardhat jest`** and your tests will be run!\n\n## Final thoughts\n\nFinally, show us some love by **starring** the repository on GitHub!️ 😊\n\nHappy hacking!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farianxdev%2Fhardhat-jest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farianxdev%2Fhardhat-jest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farianxdev%2Fhardhat-jest/lists"}