{"id":19686319,"url":"https://github.com/closeio/test-console","last_synced_at":"2026-02-24T03:33:09.360Z","repository":{"id":66129475,"uuid":"550294533","full_name":"closeio/test-console","owner":"closeio","description":"A flexible framework for managing console messages in your tests.","archived":false,"fork":false,"pushed_at":"2024-12-09T19:11:19.000Z","size":1114,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":18,"default_branch":"main","last_synced_at":"2025-10-29T02:02:41.091Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/closeio.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,"zenodo":null}},"created_at":"2022-10-12T14:15:07.000Z","updated_at":"2024-12-09T19:10:02.000Z","dependencies_parsed_at":"2024-11-11T18:32:45.484Z","dependency_job_id":"668ea3a7-0eb6-4708-ac57-12b2c3c6f741","html_url":"https://github.com/closeio/test-console","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/closeio/test-console","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/closeio%2Ftest-console","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/closeio%2Ftest-console/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/closeio%2Ftest-console/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/closeio%2Ftest-console/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/closeio","download_url":"https://codeload.github.com/closeio/test-console/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/closeio%2Ftest-console/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29770769,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T03:15:54.600Z","status":"ssl_error","status_checked_at":"2026-02-24T03:15:54.143Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-11-11T18:27:29.318Z","updated_at":"2026-02-24T03:33:09.329Z","avatar_url":"https://github.com/closeio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# test-console\n\nA flexible framework for managing console messages in your tests.\n\n## When to Use This?\n\nTest output can get clutterd with logs and warnings for many reasons:\n\n- You upgraded a library and it started showing warnings where it didn't before. There are many of these and you don't have time to resolve them all right now\n- You started using a new testing library and it's showing you output or warnings about many things all at once\n- A warning started showing and you just didn't notice at the time, but now you do\n\nWhatever the reason, if you find that there's a lot of noise in the output\nof your tests and you'd like to manage that, this library is for you!\n\n## Approach\n\nOur approach is to give you a succinct way to identify output in your tests\nand deal with them in a systematic manner.\n\nFor instance, at Close we set the test output in our CI system to only show\nCRITICAL items. That way we have only the most important information in the\noutput from our CI system, and if a test fails it's very easy to see why.\nWhile testing in watch mode in our development environment shows everything.\n\nWhen we want to eliminate a particular warning from our test system, we set\nthat matcher to be CRITICAL and run our tests with an CRITICAL threshold so\nwe only see the items we need to fix. This helps us focus on the task at\nhand and see clearly when we've reached our goal.\n\n## Install\n\n```bash\nyarn add -D @closeio/test-console\n```\n\n```bash\nnpm i --save-dev @closeio/test-console\n```\n\n## Usage\n\nIn a file that you load before running your tests, you can do something like this:\n\n```typescript\nimport { patchConsoleMethods } from '@closeio/test-console';\n\n// Make the threshold customizable from the command line\nconst threshold = process.env.TEST_CONSOLE_LEVEL || 'ERROR';\n\npatchConsoleMethods(\n  ['debug', 'info', 'log', 'warn', 'error'], // the console methods to patch\n  // A list of tests to compare against logged messages, and their associated\n  // log level if matched.\n  [\n    { matcher: /warning: failed prop type:/i, level: 'WARNING' },\n    {\n      matcher: 'Each child in a list should have a unique \"key\" prop',\n      level: 'ERROR',\n    },\n    {\n      matcher: /warning: an update to .* inside a test was not wrapped in act/i,\n      level: 'CRITICAL',\n    },\n  ],\n  {\n    // filenameRegex determines what lines from the stack trace will show when\n    // logging out the test location.\n    filenameRegex: /\\.test\\.[jt]sx?/,\n    // If given, getTestName will be called when logging out test location, to\n    // help you track down where logs are coming from.\n    getTestName: () =\u003e expect.getState().currentTestName,\n    // Log messages whose level is \u003e= the threshold will be shown, along with\n    // log messages that didn't match one of the log tests.\n    threshold,\n  },\n);\n```\n\nAnd then you can run your tests with the level you want like:\n\n    TEST_CONSOLE_LEVEL=INFO yarn test\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloseio%2Ftest-console","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloseio%2Ftest-console","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloseio%2Ftest-console/lists"}