Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
console-fail-test
Advanced tools
Gently fails test runs if the console was used during them.
console-fail-test
is meant to support any (test framework) & (spy library) combination.
It will auto-detect your combination if possible and use the most appropriate environment hooks and function spies it can find.
In general, you can use the Node API to request specific test frameworks and spy libraries:
require("console-fail-test").cft({
testFramework: "jest",
spyLibrary: "jasmine",
});
Test frameworks that are ✨ auto-detectable can be supported by just running console-fail-test/setup.js
before tests.
For others, use the Node API with their API request:
require("console-fail-test").cft({
testFramework: require("ava"),
});
Framework | Support? | API Request | Documentation |
Ava | ✅️ |
require("ava")
|
Ava.md
|
Mocha | ✅️ ✨ |
"mocha"
|
Mocha.md
|
Jasmine | ✅️ ✨ |
"jasmine"
|
Jasmine.md
|
Jest | ✅️ ✨ |
"jest"
|
Jest.md
|
lab | ✅ |
exports.lab
|
Lab.md
|
node-tap | ✅️ |
require("node-tap")
|
NodeTap.md
|
QUnit | ⚙️ |
/issues/19
| |
tape | ⚙️ |
/issues/17
| |
TestCafe | ⚙️ |
/issues/15
|
See open test framework support issues for progress!
If a supported spy library isn't detected, an internal fallback will be used to spy on console
methods.
You can request a specific test library using the Node API with its API request:
require("console-fail-test").cft({
spyLibrary: "sinon",
});
Library | Support? | API Request | Spy | Documentation |
Jasmine | ✅️ |
"jasmine"
|
jasmine.createSpy()
|
Jasmine.md
|
Jest | ✅️ |
"jest"
|
jest.fn()
|
Jest.md
|
Sinon | ✅️ |
require("sinon")
|
sinon.spy()
|
Sinon.md
|
Logging to the console during tests can be a sign of
This little library throws an error after each test if a console method was called during it. It's got some nifty features:
Look how fancy the terminal output is with Jest!
FAQs
Gently fails test runs if the console was used during them. 📢
The npm package console-fail-test receives a total of 17,567 weekly downloads. As such, console-fail-test popularity was classified as popular.
We found that console-fail-test demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.