{"_id":"vitest-console","_rev":"4-82560f76670b48456f036ca58b8406a1","name":"vitest-console","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"vitest-console","version":"0.1.0","keywords":["vitest","test","mock","custom","matchers","console"],"author":{"url":"https://hideoo.dev","name":"HiDeoo","email":"github@hideoo.dev"},"license":"MIT","_id":"vitest-console@0.1.0","maintainers":[{"name":"hideoo","email":"hideo.sup@gmail.com"}],"homepage":"https://github.com/HiDeoo/vitest-console","bugs":{"url":"https://github.com/HiDeoo/vitest-console/issues"},"dist":{"shasum":"34185872bee9f0ccd62bfd83e7713205067ed64c","tarball":"https://registry.npmjs.org/vitest-console/-/vitest-console-0.1.0.tgz","fileCount":5,"integrity":"sha512-hvpo0NUxTcLYThfqMqvxAiBJxooD71dh5VL85dkoMgpNJMaPhnrMW4UO9tl95piOgWsfQchvAHRGHRmWQO3G5g==","signatures":[{"sig":"MEYCIQCeykUPnhsZVuasmoNfuHpm6Xun6o7qqApH8AjfcRS67wIhAKNBZIi/Wto4jDT5v00W9EAAM0HCxUPbP36p+vK0p9CF","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28890,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjB7AdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoDNRAAiYfFRv0eBWffBUgiy6kJlksCenyiCN6T5obxo9hFfpbJoO9A\r\nNsGSRkg95aX8fsOpcMLHS3u6W826y/Le4+Vk1fzrp4eGi4XTM6+LxGgkKA60\r\nqFVue81iJ56pTwEv53DvvwlwaP498pQw5Z2DKfC+8O+KIWfCiKLMHRvp185E\r\nMJZ2rgzDvVE1QjAFdeTVDavkASVLvMZTo/+af7sNBWEfVT4KutjurQYPZPLz\r\nCqRa/aQqiUCq+OWdV1N+7w19tkQm0eXvMx86KlumBACB6mn5HQHicSi4AcCz\r\nmWN3cdEPBHNtIhvjp1Hjh7zUyIDT55C/Wpl0LEcRDE/KRCkl+Rl/wfyWzg4A\r\n4Vkb2+iWMPmDyfIeMherFQeOI77omvduu9UfzOUQY3WTGUXEXQyop7U2JraA\r\nij4NH6Dp7XB7yF+N3sk4pV0ZEVgTuDI3W7/2xNEPTUjSuDWGvdY7AjJOg8aS\r\n4PpuQ449NOauu8xTA5AEiIxkmURL4GSWjPLHt/PN2yGkdBd5YINMv82F24Hj\r\n4MO0RkAOnijwwz4WTCDfP6+AEqIZlOJiudcYAGBJbAVMJMgpZLFrwvpd54cZ\r\ntYRYrC1b1ph18z2BA08TDDcIkYKhiOHqjv/v6PEAtr6fgQMHzSMOuh8RdfP4\r\n7mI04J3ozme60ZCGEzdq5rpMZoyEoLlQpps=\r\n=3Ddj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.mjs","type":"module","_from":"file:vitest-console-0.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=16"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs"}},"scripts":{"dev":"unbuild --stub","lint":"prettier -c . && eslint . --max-warnings=0 && tsc --noEmit","test":"vitest","build":"unbuild"},"_npmUser":{"name":"hideoo","email":"hideo.sup@gmail.com"},"prettier":"@hideoo/prettier-config","_resolved":"/tmp/a42fe09a37f2c7db150a7bc8125881a4/vitest-console-0.1.0.tgz","_integrity":"sha512-hvpo0NUxTcLYThfqMqvxAiBJxooD71dh5VL85dkoMgpNJMaPhnrMW4UO9tl95piOgWsfQchvAHRGHRmWQO3G5g==","repository":{"url":"git+https://github.com/HiDeoo/vitest-console.git","type":"git"},"_npmVersion":"8.11.0","description":"Quickly mock various console methods in Vitest and track their calls with custom matchers","directories":{},"lint-staged":{"**/*":"prettier -w -u --cache","**/*.{js,jsx,ts,tsx,cjs,mjs}":"eslint --max-warnings=0"},"sideEffects":false,"_nodeVersion":"16.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@7.9.4","devDependencies":{"husky":"8.0.1","eslint":"8.22.0","vitest":"0.22.1","unbuild":"0.8.9","prettier":"2.7.1","typescript":"4.7.4","lint-staged":"13.0.3","@hideoo/tsconfig":"0.1.0","@hideoo/eslint-config":"0.6.0","@hideoo/prettier-config":"0.1.1"},"_npmOperationalInternal":{"tmp":"tmp/vitest-console_0.1.0_1661448221462_0.8534178634425362","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"vitest-console","version":"0.1.1","keywords":["vitest","test","mock","custom","matchers","console"],"author":{"url":"https://hideoo.dev","name":"HiDeoo","email":"github@hideoo.dev"},"license":"MIT","_id":"vitest-console@0.1.1","maintainers":[{"name":"hideoo","email":"hideo.sup@gmail.com"}],"homepage":"https://github.com/HiDeoo/vitest-console","bugs":{"url":"https://github.com/HiDeoo/vitest-console/issues"},"dist":{"shasum":"eb7ef25b88cfca3952c9a40fd832f43c3e31d789","tarball":"https://registry.npmjs.org/vitest-console/-/vitest-console-0.1.1.tgz","fileCount":5,"integrity":"sha512-GRRCFSbyW7iOyu9bvJhJlMQtTwAol4zH5i0uHRLWDPcaJND7HjlpbdvaHF4/Cdeh+FH5OQ4qHe4CbvYe0ioLmA==","signatures":[{"sig":"MEUCIDgQXBBmM2AI5ir0qruM0NzjEkRKpQqrH1D9kxa2I4DwAiEA0TKMX21Xv37hf6rP85rl856v6aahgBJE8/lZb1SEsO0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28982,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjB7NkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq/dQ//RpLvMctIpx1HLdxtO+FB+kuokZdWinStz4elQ3wuyKPzQuoC\r\n0rNdL7MxjJ4JTrpGW9AQefEfHzqw3/MVbs4x1tcVl3bbYO03tKzHA04TtfNu\r\nddGzAx/0Vl4BUx/LZoGnl8iYc5UipOH3NAzLlStaDBoxZhz0J/zWd7XUO1Hu\r\nvOEwffzUySnuR8tUWvAEVUCkOTOemNVW3Al3tki60jDYOsgvWCsWDA3OK3s8\r\nTsa2ETFBXsTqc2Xe2Faxg3MyU5GmoKneS3677UIOOHD7STiVhrzc1dVfhkiT\r\nFtHc/FoS2vaKGw9Dd2YahWR6hlQHAYuVC0Lg4odi7TjpiDZfF1TNkcnqY/id\r\n6EvGqW1D1JhZbH2FZo682g09Kjps/uVQcEyItesaIOWPDn678yXtYR+gafjE\r\nbiF4Q0Bj404yYrr7vq+18QwYckndvtepXTlOEt2i/L0KnwZmIGRAgvxZFpo7\r\njTCTPp7nyST2jt9E8GzljmhG21LpHSMweNrKYyiadgsqsZq2KT1VSNR9GTfB\r\nb33p4eSMYvrzYXsHbPs4//ADsKW5TyPPW5afs2aZnXIEPIPfDStr5xHFFBaE\r\nF0fZ0/ILeXVR0zNU+uZuqMddIaDJv6BF8yx3ez26LgFsvmqxYkjU1Ib2wIQ8\r\niq6RY9k+hBTKi7CA/Wy7gkthsDvD3145FR4=\r\n=asHb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.mjs","type":"module","_from":"file:vitest-console-0.1.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=16"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs"}},"scripts":{"dev":"unbuild --stub","lint":"prettier -c . && eslint . --max-warnings=0 && tsc --noEmit","test":"vitest","build":"unbuild"},"_npmUser":{"name":"hideoo","email":"hideo.sup@gmail.com"},"prettier":"@hideoo/prettier-config","_resolved":"/tmp/6aeee04b915cd6c7c2d4ee192c3c99a0/vitest-console-0.1.1.tgz","_integrity":"sha512-GRRCFSbyW7iOyu9bvJhJlMQtTwAol4zH5i0uHRLWDPcaJND7HjlpbdvaHF4/Cdeh+FH5OQ4qHe4CbvYe0ioLmA==","repository":{"url":"git+https://github.com/HiDeoo/vitest-console.git","type":"git"},"_npmVersion":"8.11.0","description":"Quickly mock various console methods in Vitest and track their calls with custom matchers","directories":{},"lint-staged":{"**/*":"prettier -w -u --cache","**/*.{js,jsx,ts,tsx,cjs,mjs}":"eslint --max-warnings=0"},"sideEffects":false,"_nodeVersion":"16.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@7.9.4","devDependencies":{"husky":"8.0.1","eslint":"8.22.0","vitest":"0.22.1","unbuild":"0.8.9","prettier":"2.7.1","typescript":"4.7.4","lint-staged":"13.0.3","@hideoo/tsconfig":"0.1.0","@hideoo/eslint-config":"0.6.0","@hideoo/prettier-config":"0.1.1"},"_npmOperationalInternal":{"tmp":"tmp/vitest-console_0.1.1_1661449059830_0.6572951054206442","host":"s3://npm-registry-packages"}},"0.2.0":{"name":"vitest-console","version":"0.2.0","keywords":["vitest","test","mock","custom","matchers","console"],"author":{"url":"https://hideoo.dev","name":"HiDeoo","email":"github@hideoo.dev"},"license":"MIT","_id":"vitest-console@0.2.0","maintainers":[{"name":"hideoo","email":"hideo.sup@gmail.com"}],"homepage":"https://github.com/HiDeoo/vitest-console","bugs":{"url":"https://github.com/HiDeoo/vitest-console/issues"},"dist":{"shasum":"8ff8913f8477e3c11380b7428325a541ac3f88c5","tarball":"https://registry.npmjs.org/vitest-console/-/vitest-console-0.2.0.tgz","fileCount":6,"integrity":"sha512-t+C7eyspNXa7LyVxkNSUMnFQrtAdL392pvanyt4IWXYZ5F9dZaOl0dANQzSDePW3mZW7OHiGD24SYzppJRERuQ==","signatures":[{"sig":"MEQCIGomgAn4H81J/O9Ch3sF+bvPb2FCsRC3bMIK/RY6xRvwAiBKDvGECrxT+QPJAnSm/oOBOI14SLcJ3KEKaG0Gk5Wkpg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":34640},"main":"./dist/index.mjs","type":"module","_from":"file:vitest-console-0.2.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs"}},"scripts":{"dev":"unbuild --stub","lint":"prettier -c . && eslint . --max-warnings=0 && tsc --noEmit","test":"vitest","build":"unbuild"},"_npmUser":{"name":"hideoo","email":"hideo.sup@gmail.com"},"prettier":"@hideoo/prettier-config","_resolved":"/tmp/2fc73781f523b1426648ac4f5f4cdc8e/vitest-console-0.2.0.tgz","_integrity":"sha512-t+C7eyspNXa7LyVxkNSUMnFQrtAdL392pvanyt4IWXYZ5F9dZaOl0dANQzSDePW3mZW7OHiGD24SYzppJRERuQ==","repository":{"url":"git+https://github.com/HiDeoo/vitest-console.git","type":"git"},"_npmVersion":"10.8.2","description":"Quickly mock various console methods in Vitest and track their calls with custom matchers","directories":{},"lint-staged":{"**/*":"prettier -w -u --cache","**/*.{js,jsx,ts,tsx,cjs,mjs}":"eslint --max-warnings=0"},"sideEffects":false,"_nodeVersion":"18.20.5","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@8.6.9","devDependencies":{"husky":"8.0.1","eslint":"8.22.0","unbuild":"0.8.9","prettier":"2.7.1","typescript":"4.7.4","lint-staged":"13.0.3","@vitest/expect":"2.1.8","@hideoo/tsconfig":"0.1.0","@hideoo/eslint-config":"0.6.0","@hideoo/prettier-config":"0.1.1"},"peerDependencies":{"vitest":">=2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/vitest-console_0.2.0_1736770740874_0.06097630926329378","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"vitest-console","version":"0.2.1","license":"MIT","description":"Quickly mock various console methods in Vitest and track their calls with custom matchers","author":{"name":"HiDeoo","email":"github@hideoo.dev","url":"https://hideoo.dev"},"type":"module","main":"./dist/index.mjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","types":"./dist/index.d.ts"}},"devDependencies":{"@hideoo/eslint-config":"0.6.0","@hideoo/prettier-config":"0.1.1","@hideoo/tsconfig":"0.1.0","@vitest/expect":"2.1.8","eslint":"8.22.0","husky":"8.0.1","lint-staged":"13.0.3","prettier":"2.7.1","typescript":"4.7.4","unbuild":"0.8.9"},"peerDependencies":{"vitest":">=2.0.0"},"engines":{"node":">=18"},"packageManager":"pnpm@8.6.9","publishConfig":{"access":"public"},"sideEffects":false,"keywords":["vitest","test","mock","custom","matchers","console"],"homepage":"https://github.com/HiDeoo/vitest-console","repository":{"type":"git","url":"git+https://github.com/HiDeoo/vitest-console.git"},"bugs":{"url":"https://github.com/HiDeoo/vitest-console/issues"},"prettier":"@hideoo/prettier-config","lint-staged":{"**/*":"prettier -w -u --cache","**/*.{js,jsx,ts,tsx,cjs,mjs}":"eslint --max-warnings=0"},"scripts":{"dev":"unbuild --stub","build":"unbuild","test":"vitest","lint":"prettier -c . && eslint . --max-warnings=0 && tsc --noEmit"},"_id":"vitest-console@0.2.1","_integrity":"sha512-riH2lqk0ioVLHCNVIOa0T7YBsf1QFct2wlAiLvO3nKei38MDjNyI/It1/UduiVQLg6QI4XY5iQECGhki12RXKQ==","_resolved":"/tmp/27dab7e9eb14527916a0e184e8240ae5/vitest-console-0.2.1.tgz","_from":"file:vitest-console-0.2.1.tgz","_nodeVersion":"24.10.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-riH2lqk0ioVLHCNVIOa0T7YBsf1QFct2wlAiLvO3nKei38MDjNyI/It1/UduiVQLg6QI4XY5iQECGhki12RXKQ==","shasum":"32d914988c89f9aaa6c7b2b0fc61d16cf5416aa9","tarball":"https://registry.npmjs.org/vitest-console/-/vitest-console-0.2.1.tgz","fileCount":6,"unpackedSize":34640,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/vitest-console@0.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFLbHGkHZhTcaggCJvSBZQvOnCVDdD4vT0SCPedr+KjQAiEAsEak+dZ2gEsTmfuTwVHwAg1lHjYy8o+nnI+SWLR2+z8="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ad218cb3-e902-4036-adad-e8fc07459c37"}},"directories":{},"maintainers":[{"name":"hideoo","email":"hideo.sup@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vitest-console_0.2.1_1760634677588_0.5883718244861105"},"_hasShrinkwrap":false}},"time":{"created":"2022-08-25T17:23:41.394Z","modified":"2025-10-16T17:11:18.248Z","0.1.0":"2022-08-25T17:23:41.605Z","0.1.1":"2022-08-25T17:37:40.013Z","0.2.0":"2025-01-13T12:19:01.083Z","0.2.1":"2025-10-16T17:11:17.800Z"},"bugs":{"url":"https://github.com/HiDeoo/vitest-console/issues"},"author":{"name":"HiDeoo","email":"github@hideoo.dev","url":"https://hideoo.dev"},"license":"MIT","homepage":"https://github.com/HiDeoo/vitest-console","keywords":["vitest","test","mock","custom","matchers","console"],"repository":{"type":"git","url":"git+https://github.com/HiDeoo/vitest-console.git"},"description":"Quickly mock various console methods in Vitest and track their calls with custom matchers","maintainers":[{"name":"hideoo","email":"hideo.sup@gmail.com"}],"readme":"<div align=\"center\">\n  <h1>vitest-console 📰</h1>\n  <p>Vitest <code>console</code> mocks and custom matchers</p>\n</div>\n\n<div align=\"center\">\n  <a href=\"https://github.com/HiDeoo/vitest-console/actions/workflows/integration.yml\">\n    <img alt=\"Integration Status\" src=\"https://github.com/HiDeoo/vitest-console/actions/workflows/integration.yml/badge.svg\" />\n  </a>\n  <a href=\"https://github.com/HiDeoo/vitest-console/blob/main/LICENSE\">\n    <img alt=\"License\" src=\"https://badgen.net/github/license/HiDeoo/vitest-console\" />\n  </a>\n  <br />\n  <br />\n</div>\n\nQuickly mock various `console` methods in Vitest and track their calls with custom matchers.\n\n- [Usage](#usage)\n- [Mock](#mock)\n- [Matchers](#matchers)\n  - [toHaveErrored](#tohaveerrored)\n  - [toHaveErroredTimes](#tohaveerroredtimes)\n  - [toHaveErroredWith](#tohaveerroredwith)\n  - [toHaveLastErroredWith](#tohavelasterroredwith)\n  - [toHaveNthErroredWith](#tohaventherroredwith)\n  - [toHaveInformed](#tohaveinformed)\n  - [toHaveInformedTimes](#tohaveinformedtimes)\n  - [toHaveInformedWith](#tohaveinformedwith)\n  - [toHaveLastInformedWith](#tohavelastinformedwith)\n  - [toHaveNthInformedWith](#tohaventhinformedwith)\n  - [toHaveLogged](#tohavelogged)\n  - [toHaveLoggedTimes](#tohaveloggedtimes)\n  - [toHaveLoggedWith](#tohaveloggedwith)\n  - [toHaveLastLoggedWith](#tohavelastloggedwith)\n  - [toHaveNthLoggedWith](#tohaventhloggedwith)\n  - [toHaveWarned](#tohavewarned)\n  - [toHaveWarnedTimes](#tohavewarnedtimes)\n  - [toHaveWarnedWith](#tohavewarnedwith)\n  - [toHaveLastWarnedWith](#tohavelastwarnedwith)\n  - [toHaveNthWarnedWith](#tohaventhwarnedwith)\n\n## Usage\n\nInstall `vitest-console` with your favorite package manager:\n\n```shell\n$ pnpm add -D vitest-console\n```\n\nAdd a setup file to your [Vitest configuration](https://vitest.dev/config/#configuration) and inline the `vitest-console` module:\n\n```ts\nimport { defineConfig } from 'vitest/config'\n\nexport default defineConfig({\n  test: {\n    server: {\n      deps: {\n        inline: ['vitest-console'],\n      },\n    },\n    setupFiles: ['tests-setup.ts'],\n  },\n})\n```\n\nExtends the built-in Vitest matchers with `vitest-console` in your setup file:\n\n```ts\nimport { expect } from 'vitest'\nimport { matchers } from 'vitest-console'\n\nexpect.extend(matchers)\n```\n\nYou can now mock various `console` methods either globally in your setup file, in a test file or even a `describe` block:\n\n```ts\nimport { afterAll, afterEach } from 'vitest'\nimport { mockConsole } from 'vitest-console'\n\nconst { clearConsole, restoreConsole } = mockConsole()\n\nafterEach(clearConsole)\nafterAll(restoreConsole)\n```\n\n> **Note**\n>\n> You can also mock `console` methods in a specific test:\n>\n> ```ts\n> test('should do the thing', () => {\n>   const { restoreConsole } = mockConsole()\n>\n>   doTheThing()\n>\n>   expect(console).toHaveLogged('The thing was done.')\n>\n>   restoreConsole()\n> })\n> ```\n\n## Mock\n\nMocks are set up using the `mockConsole` function:\n\n```ts\nmockConsole(methods?: ConsoleMethods): ConsoleMock\nmockConsole(options?: ConsoleMockOptions): ConsoleMock\nmockConsole(methods: ConsoleMethods, options: ConsoleMockOptions): ConsoleMock\n```\n\n### Parameters\n\n#### `methods`\n\nBy default, `console.error`, `console.info`, `console.log` and `console.warn` are mocked but you can specify your own list of methods to mock:\n\n```ts\nimport { mockConsole } from 'vitest-console'\n\nmockConsole(['log', 'table'])\n```\n\n#### `options`\n\nYou can silence any console output during tests using the `quiet` option:\n\n```ts\nimport { mockConsole } from 'vitest-console'\n\nmockConsole({ quiet: true })\n```\n\n### Return value\n\nThe `mockConsole` function returns an object that contains two functions to clear (reset all informations about every call) and restore (revert the original console method implementations) the `console`:\n\n```ts\nimport { afterAll, afterEach } from 'vitest'\nimport { mockConsole } from 'vitest-console'\n\nconst { clearConsole, restoreConsole } = mockConsole()\n\nafterEach(clearConsole)\nafterAll(restoreConsole)\n```\n\n## Matchers\n\n### toHaveErrored\n\nAsserts that an error was logged.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if an error was logged', () => {\n  expect(console).toHaveErrored()\n})\n```\n\n### toHaveErroredTimes\n\nAsserts that a certain amount of errors were logged.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if 3 errors were logged', () => {\n  expect(console).toHaveErroredTimes(3)\n})\n```\n\n### toHaveErroredWith\n\nAsserts that an error was logged with certain parameters.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if an error was logged with a specific text and number', () => {\n  expect(console).toHaveErroredWith('the error message', 123)\n})\n```\n\n### toHaveLastErroredWith\n\nAsserts that errors were logged and that the last one was logged with certain parameters.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if the last error was logged with a specific text and number', () => {\n  expect(console).toHaveLastErroredWith('the last error message', 123)\n})\n```\n\n### toHaveNthErroredWith\n\nAsserts that errors were logged and that a specific one was logged with certain parameters.\n\nThe count starts at 1.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if the second error was logged with a specific text and number', () => {\n  expect(console).toHaveNthErroredWith(2, 'the second error message', 123)\n})\n```\n\n### toHaveInformed\n\nAsserts that an informational message was logged.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if an informational message was logged', () => {\n  expect(console).toHaveInformed()\n})\n```\n\n### toHaveInformedTimes\n\nAsserts that a certain amount of informational messages were logged.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if 3 informational messages were logged', () => {\n  expect(console).toHaveInformedTimes(3)\n})\n```\n\n### toHaveInformedWith\n\nAsserts that an informational message was logged with certain parameters.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if an informational message was logged with a specific text and number', () => {\n  expect(console).toHaveInformedWith('the informational message', 123)\n})\n```\n\n### toHaveLastInformedWith\n\nAsserts that informational messages were logged and that the last one was logged with certain parameters.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if the last informational message was logged with a specific text and number', () => {\n  expect(console).toHaveLastInformedWith('the last informational message', 123)\n})\n```\n\n### toHaveNthInformedWith\n\nAsserts that informational messages were logged and that a specific one was logged with certain parameters.\n\nThe count starts at 1.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if the second informational message was logged with a specific text and number', () => {\n  expect(console).toHaveNthInformedWith(2, 'the second informational message', 123)\n})\n```\n\n### toHaveLogged\n\nAsserts that a message was logged.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if a message was logged', () => {\n  expect(console).toHaveLogged()\n})\n```\n\n### toHaveLoggedTimes\n\nAsserts that a certain amount of messages were logged.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if 3 messages were logged', () => {\n  expect(console).toHaveLoggedTimes(3)\n})\n```\n\n### toHaveLoggedWith\n\nAsserts that a message was logged with certain parameters.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if a message was logged with a specific text and number', () => {\n  expect(console).toHaveLoggedWith('the message', 123)\n})\n```\n\n### toHaveLastLoggedWith\n\nAsserts that messages were logged and that the last one was logged with certain parameters.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if the last message was logged with a specific text and number', () => {\n  expect(console).toHaveLastLoggedWith('the last message', 123)\n})\n```\n\n### toHaveNthLoggedWith\n\nAsserts that messages were logged and that a specific one was logged with certain parameters.\n\nThe count starts at 1.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if the second message was logged with a specific text and number', () => {\n  expect(console).toHaveNthLoggedWith(2, 'the second message', 123)\n})\n```\n\n### toHaveWarned\n\nAsserts that a warning was logged.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if a message was logged', () => {\n  expect(console).toHaveWarned()\n})\n```\n\n### toHaveWarnedTimes\n\nAsserts that a certain amount of warnings were logged.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if 3 warnings were logged', () => {\n  expect(console).toHaveWarnedTimes(3)\n})\n```\n\n### toHaveWarnedWith\n\nAsserts that a warning was logged with certain parameters.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if a warning was logged with a specific text and number', () => {\n  expect(console).toHaveWarnedWith('the warning', 123)\n})\n```\n\n### toHaveLastWarnedWith\n\nAsserts that warnings were logged and that the last one was logged with certain parameters.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if the last warning was logged with a specific text and number', () => {\n  expect(console).toHaveLastWarnedWith('the last warning', 123)\n})\n```\n\n### toHaveNthWarnedWith\n\nAsserts that warnings were logged and that a specific one was logged with certain parameters.\n\nThe count starts at 1.\n\n```ts\nimport { expect, test } from 'vitest'\n\ntest('should test if the second warning was logged with a specific text and number', () => {\n  expect(console).toHaveNthWarnedWith(2, 'the second warning', 123)\n})\n```\n\n## Vitest matchers\n\nIf needed, you can also use the built-in matchers from Vitest with mocks created using `vitest-console`.\n\n```ts\nimport { expect, test } from 'vitest'\nimport { mockConsole } from 'vitest-console'\n\ntest('should test if a message was logged', () => {\n  const { restoreConsole } = mockConsole()\n\n  expect(console.log).toHaveBeenCalled()\n\n  restoreConsole()\n})\n```\n\n## License\n\nLicensed under the MIT License, Copyright © HiDeoo.\n\nSee [LICENSE](https://github.com/HiDeoo/vitest-console/blob/main/LICENSE) for more information.\n","readmeFilename":"README.md"}