Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

console-fail-test

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

console-fail-test - npm Package Compare versions

Comparing version 0.2.3 to 0.4.0

lib/cft.cjs

31

LICENSE.md
# MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{
"author": "Josh Goldberg <me@joshuakgoldberg.com>",
"name": "console-fail-test",
"description": "Gently fails test runs if the console was used during them.",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.34.0",
"@typescript-eslint/parser": "^5.34.0",
"commitlint": "^17.0.3",
"cspell": "^6.8.0",
"eslint": "^8.22.0",
"eslint-config-prettier": "^8.5.0",
"husky": "^8.0.0",
"markdownlint-cli": "^0.32.2",
"npm-run-all": "^4.1.5",
"prettier": "^2.7.1",
"pretty-quick": "^3.1.3",
"typescript": "^4.7.4",
"vitest": "^0.31.0"
},
"main": "src/index.js",
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged --write"
}
},
"keywords": [
"console",
"fail",
"info",
"jest",
"log",
"test",
"warn"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/JoshuaKGoldberg/console-fail-test.git"
},
"scripts": {
"compile": "tsc",
"format": "prettier \"**/*\" --ignore-unknown",
"format:write": "yarn format --write",
"lint": "yarn eslint \"src/*.ts\" --max-warnings 0 --report-unused-disable-directives",
"lint:md": "yarn markdownlint \"**/*.md\" \".github/**/*.md\"",
"lint:spelling": "cspell \"**\" \".github/**/*\"",
"prepare": "husky install",
"test": "vitest"
},
"version": "0.2.3"
"name": "console-fail-test",
"version": "0.4.0",
"description": "Gently fails test runs if the console was used during them. πŸ“’",
"repository": {
"type": "git",
"url": "https://github.com/JoshuaKGoldberg/console-fail-test"
},
"license": "MIT",
"author": {
"name": "JoshuaKGoldberg",
"email": "npm@joshuakgoldberg.com"
},
"type": "module",
"exports": {
".": {
"types": {
"import": "./lib/index.d.mts",
"require": "./lib/index.d.ts"
},
"import": "./lib/index.mjs",
"require": "./lib/index.js"
}
},
"main": "./lib/index.js",
"files": [
"lib/",
"package.json",
"LICENSE.md",
"README.md"
],
"scripts": {
"build": "tsup",
"format": "prettier .",
"lint": "eslint . --max-warnings 0",
"lint:knip": "knip",
"lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line",
"lint:packages": "pnpm dedupe --check",
"lint:spelling": "cspell \"**\" \".github/**/*\"",
"prepare": "husky",
"should-semantic-release": "should-semantic-release --verbose",
"test": "vitest",
"tsc": "tsc"
},
"lint-staged": {
"*": "prettier --ignore-unknown --write"
},
"devDependencies": {
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
"@eslint/js": "^9.6.0",
"@release-it/conventional-changelog": "^8.0.1",
"@types/eslint-plugin-markdown": "^2.0.2",
"@types/eslint__js": "^8.42.3",
"@vitest/coverage-v8": "2.0.1",
"cspell": "^8.10.4",
"eslint": "^8.53.0",
"eslint-plugin-jsdoc": "^48.6.0",
"eslint-plugin-jsonc": "^2.16.0",
"eslint-plugin-markdown": "^5.0.0",
"eslint-plugin-n": "^17.9.0",
"eslint-plugin-package-json": "^0.15.0",
"eslint-plugin-perfectionist": "^2.11.0",
"eslint-plugin-regexp": "^2.6.0",
"eslint-plugin-vitest": "^0.5.4",
"eslint-plugin-yml": "^1.14.0",
"husky": "^9.0.11",
"jsonc-eslint-parser": "^2.4.0",
"knip": "^5.25.1",
"lint-staged": "^15.2.7",
"markdownlint": "^0.34.0",
"markdownlint-cli": "^0.41.0",
"prettier": "^3.3.2",
"prettier-plugin-curly": "^0.2.1",
"prettier-plugin-packagejson": "^2.5.0",
"prettier-plugin-sh": "^0.14.0",
"release-it": "^17.5.0",
"sentences-per-line": "^0.2.1",
"should-semantic-release": "^0.3.0",
"tsup": "^8.1.0",
"typescript": "^5.5.3",
"typescript-eslint": "^7.16.0",
"vitest": "^2.0.1"
},
"packageManager": "pnpm@9.4.0",
"engines": {
"node": ">=18"
},
"publishConfig": {
"provenance": true
}
}

@@ -1,10 +0,30 @@

# console-fail-test
<h1 align="center">console-fail-test</h1>
[![GitHub CI](https://github.com/JoshuaKGoldberg/console-fail-test/actions/workflows/compile.yml/badge.svg)](https://github.com/JoshuaKGoldberg/console-fail-test/actions/workflows/compile.yml)
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-brightgreen.svg)](https://prettier.io)
![TypeScript: Strict](https://img.shields.io/badge/typescript-strict-brightgreen.svg)
[![NPM version](https://badge.fury.io/js/console-fail-test.svg)](http://badge.fury.io/js/console-fail-test)
[![Downloads](http://img.shields.io/npm/dm/console-fail-test.svg)](https://npmjs.org/package/console-fail-test)
<p align="center">Gently fails test runs if the console was used during them. πŸ“’</p>
Gently fails test runs if the console was used during them.
<p align="center">
<a href="#contributors" target="_blank">
<!-- prettier-ignore-start -->
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<img alt="All Contributors: 5 πŸ‘ͺ" src="https://img.shields.io/badge/all_contributors-5_πŸ‘ͺ-21bb42.svg" />
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<!-- prettier-ignore-end -->
</a>
<a href="https://codecov.io/gh/JoshuaKGoldberg/console-fail-test" target="_blank">
<img alt="Codecov Test Coverage" src="https://codecov.io/gh/JoshuaKGoldberg/console-fail-test/branch/main/graph/badge.svg"/>
</a>
<a href="https://github.com/JoshuaKGoldberg/console-fail-test/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank">
<img alt="Contributor Covenant" src="https://img.shields.io/badge/code_of_conduct-enforced-21bb42" />
</a>
<a href="https://github.com/JoshuaKGoldberg/console-fail-test/blob/main/LICENSE.md" target="_blank">
<img alt="License: MIT" src="https://img.shields.io/github/license/JoshuaKGoldberg/console-fail-test?color=21bb42">
</a>
<a href="https://github.com/sponsors/JoshuaKGoldberg" target="_blank">
<img alt="Sponsor: On GitHub" src="https://img.shields.io/badge/sponsor-on_github-21bb42.svg" />
</a>
<img alt="Style: Prettier" src="https://img.shields.io/badge/style-prettier-21bb42.svg" />
<img alt="TypeScript: Strict" src="https://img.shields.io/badge/typescript-strict-21bb42.svg" />
<img alt="npm package version" src="https://img.shields.io/npm/v/console-fail-test?color=21bb42" />
<img alt="Contributor Covenant" src="https://img.shields.io/badge/code_of_conduct-enforced-21bb42" />
</p>

@@ -52,3 +72,5 @@ ## Why?

// jest.config.js
setupFilesAfterEnv: ["console-fail-test/setup.js"],
module.exports = {
setupFilesAfterEnv: ["console-fail-test/setup.js"],
};
```

@@ -234,3 +256,3 @@

require("console-fail-test").cft({
spyLibrary: "sinon",
spyLibrary: "sinon",
});

@@ -307,2 +329,21 @@ ```

</tr>
<tr>
<td>Vitest</td>
<td>
βœ…οΈ
</td>
<td>
<code>"vitest"</code>
</td>
<td>
<a href="https://vitest.dev/guide/mocking.html#functions">
<code>vi.fn()</code>
</a>
</td>
<td>
<a href="./docs/Vitest.md#spies">
<code>Vitest.md#spies</code>
</a>
</td>
</tr>
</tbody>

@@ -313,9 +354,10 @@ </table>

By default, `console-fail-test` will error on _any_ called `console` method. If you'd like allow certain methods, pass a `console` object to the `cft` API when you set it up:
By default, `console-fail-test` will error on _any_ called `console` method.
If you'd like allow certain methods, pass a `console` object to the `cft` API when you set it up:
```js
require("console-fail-test").cft({
console: {
warn: true, // won't error on any instance of console.warn
},
console: {
warn: true, // won't error on any instance of console.warn
},
});

@@ -348,1 +390,27 @@ ```

See [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md).
## Contributors
<!-- spellchecker: disable -->
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mackenco"><img src="https://avatars.githubusercontent.com/u/4284340?v=4?s=100" width="100px;" alt="Colin MacKenzie"/><br /><sub><b>Colin MacKenzie</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/console-fail-test/commits?author=mackenco" title="Code">πŸ’»</a> <a href="#ideas-mackenco" title="Ideas, Planning, & Feedback">πŸ€”</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.kop.ax/"><img src="https://avatars.githubusercontent.com/u/77674046?v=4?s=100" width="100px;" alt="Dimitri Kopriwa"/><br /><sub><b>Dimitri Kopriwa</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/console-fail-test/commits?author=kopax-polyconseil" title="Code">πŸ’»</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/joel-darΓ³s-95536a21/?locale=en_US"><img src="https://avatars.githubusercontent.com/u/992049?v=4?s=100" width="100px;" alt="Joel"/><br /><sub><b>Joel</b></sub></a><br /><a href="#ideas-joel-daros" title="Ideas, Planning, & Feedback">πŸ€”</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.joshuakgoldberg.com"><img src="https://avatars.githubusercontent.com/u/3335181?v=4?s=100" width="100px;" alt="Josh Goldberg"/><br /><sub><b>Josh Goldberg</b></sub></a><br /><a href="#tool-JoshuaKGoldberg" title="Tools">πŸ”§</a> <a href="https://github.com/JoshuaKGoldberg/console-fail-test/commits?author=JoshuaKGoldberg" title="Code">πŸ’»</a> <a href="#maintenance-JoshuaKGoldberg" title="Maintenance">🚧</a> <a href="#infra-JoshuaKGoldberg" title="Infrastructure (Hosting, Build-Tools, etc)">πŸš‡</a> <a href="#ideas-JoshuaKGoldberg" title="Ideas, Planning, & Feedback">πŸ€”</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sosukesuzuki"><img src="https://avatars.githubusercontent.com/u/14838850?v=4?s=100" width="100px;" alt="SUZUKI Sosuke"/><br /><sub><b>SUZUKI Sosuke</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/console-fail-test/commits?author=sosukesuzuki" title="Code">πŸ’»</a></td>
</tr>
</tbody>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
<!-- spellchecker: enable -->
> πŸ’™ This package is based on [@JoshuaKGoldberg](https://github.com/JoshuaKGoldberg)'s [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc