{"id":17932468,"url":"https://github.com/cheap-glitch/why-is-node-still-running","last_synced_at":"2025-03-24T05:32:27.886Z","repository":{"id":55100268,"uuid":"321162334","full_name":"cheap-glitch/why-is-node-still-running","owner":"cheap-glitch","description":"🏃 Find out exactly why Node is still running.","archived":false,"fork":false,"pushed_at":"2021-01-13T18:11:23.000Z","size":345,"stargazers_count":23,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-19T02:22:49.276Z","etag":null,"topics":["asynchronous-tasks","node-debugger","node-module","open-handles","process-monitoring","typescript-port"],"latest_commit_sha":null,"homepage":"https://npm.im/why-is-node-still-running","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cheap-glitch.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}},"created_at":"2020-12-13T21:19:44.000Z","updated_at":"2024-06-18T16:32:35.000Z","dependencies_parsed_at":"2022-08-14T12:00:32.571Z","dependency_job_id":null,"html_url":"https://github.com/cheap-glitch/why-is-node-still-running","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheap-glitch%2Fwhy-is-node-still-running","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheap-glitch%2Fwhy-is-node-still-running/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheap-glitch%2Fwhy-is-node-still-running/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheap-glitch%2Fwhy-is-node-still-running/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheap-glitch","download_url":"https://codeload.github.com/cheap-glitch/why-is-node-still-running/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245217136,"owners_count":20579288,"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":["asynchronous-tasks","node-debugger","node-module","open-handles","process-monitoring","typescript-port"],"created_at":"2024-10-28T21:27:27.172Z","updated_at":"2025-03-24T05:32:27.574Z","avatar_url":"https://github.com/cheap-glitch.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🏃 why-is-node-still-running\n\n![License](https://badgen.net/github/license/cheap-glitch/why-is-node-still-running?color=green)\n![Latest release](https://badgen.net/github/release/cheap-glitch/why-is-node-still-running?color=green)\n[![Coverage status](https://coveralls.io/repos/github/cheap-glitch/why-is-node-still-running/badge.svg?branch=main)](https://coveralls.io/github/cheap-glitch/why-is-node-still-running?branch=main)\n\n\u003e This is a port of mafintosh' [why-is-node-running](https://github.com/mafintosh/why-is-node-running)\n\u003e module to TypeScript, with modernized syntax and no dependencies.\n\n```javascript\nconst { whyIsNodeStillRunning } = require('why-is-node-still-running');\nconst { createServer } = require('net');\n\nconst server = createServer();\nserver.listen(0);\n\nwhyIsNodeStillRunning();\n// There are 2 handle(s) keeping the process running\n```\n\n## Installation\n\n```shell\nnpm i -D why-is-node-still-running\n```\n\n## Usage\n\n**Always import this module first** so  that the asynchronous hook can be setup.\nThe hook  will log  to the console  by default,  but you can  provide it  with a\ncustom logger that implements `error()`.\n\n### Example of usage with Jest\n\nSometimes Jest  complains that there  are asynchronous operations  still hanging\nafter the tests  have been completed. When the  `--detectOpenHandles` flag gives\nno output, you can try using this module to help pinpoint the cause:\n\n\u003c!-- https://github.com/facebook/jest/issues/7287#issuecomment-648974271 --\u003e\n```javascript\nimport { whyIsNodeStillRunning } from 'why-is-node-still-running';\n\nafterAll(async () =\u003e {\n\t// Do your actual cleanup here\n\t// [...]\n\n\t// Print the handles still opened\n\tawait new Promise(resolve =\u003e setTimeout(() =\u003e {\n\t\twhyIsNodeStillRunning();\n\t\tresolve();\n\t}, 4000));\n});\n```\n\nDon't forget to run Jest with `--useStderr` to show console output.\n\nAlternatively, you can use this module to print some information about the stack\nregularly while the tests are running (e.g. see [this comment](https://github.com/facebook/jest/issues/9473#issuecomment-675738694)).\n\n## License\n\n```text\nCopyright (c) 2020-present, cheap glitch\n\nPermission to use, copy, modify, and/or distribute this software for any purpose\nwith or without fee is hereby  granted, provided that the above copyright notice\nand this permission notice appear in all copies.\n\nTHE SOFTWARE  IS PROVIDED \"AS IS\"  AND THE AUTHOR DISCLAIMS  ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\nFITNESS.  IN NO  EVENT  SHALL THE  AUTHOR  BE LIABLE  FOR  ANY SPECIAL,  DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS\nOF USE, DATA OR  PROFITS, WHETHER IN AN ACTION OF  CONTRACT, NEGLIGENCE OR OTHER\nTORTIOUS ACTION, ARISING OUT OF OR IN  CONNECTION WITH THE USE OR PERFORMANCE OF\nTHIS SOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheap-glitch%2Fwhy-is-node-still-running","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheap-glitch%2Fwhy-is-node-still-running","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheap-glitch%2Fwhy-is-node-still-running/lists"}