Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
fixture-stdout
Advanced tools
A test fixture to intercept writes to stdout.
npm install fixture-stdout
var StdOutFixture = require('fixture-stdout');
var fixture = new StdOutFixture();
// Keep track of writes so we can check them later..
var _writes = [];
// Capture a write to stdout
fixture.capture( function onWrite (string, encoding, fd) {
_writes.push({
string: string,
encoding: encoding,
fd: fd
});
// If you return `false`, you'll prevent the write to the original stream (useful for preventing log output during tests.)
return false;
});
// Uses intercepted version of stdout
console.log('a');
console.log('b');
fixture.release();
// Now we're back to the original version of stdout
console.log('c');
console.log('d');
// Voila!
// Only the first two logs ("a" and "b") are in our `_writes` array
stdout
:var Fixture = require('fixture-stdout');
var fixture = new Fixture({
stream: process.stderr
});
fixture.capture();
console.error('hello world');
fixture.release();
console.error('world');
Based on @pguillory's example.
MIT
FAQs
A test fixture to intercept writes to stdout.
We found that fixture-stdout demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.