
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Returns a deep copy of an object with all functions converted to spies.
Install with npm
:
npm install 007
// we want to test github
var github = require('github');
var doubleOhSeven = require('007');
var mockGithub = doubleOhSeven(github);
mockGithub.pullRequests.getCommits.returns = function () {
return {
foo: 'beep'
};
};
assert(mockGithub.pullRequests.getCommits('lalala').foo === 'beep');
assert(mockGithub.pullRequests.getCommits.callCount === 1);
doubleOhSeven()
Takes an object or function as an argument, returns a function or object matching the original, but with mocked out functions.
mockFn.implementation
The implementation of the mock function.
Set with =
:
Ex:
mockFn.implementation = function (val, cb) {
return cb(val + 1);
};
The following functions are helpers for implementation; using them will override mockFn.implementation
.
mockFn.returns()
The return value of the mock.
Ex:
mockFn.returns('foo');
mockFn(function (arg) {
console.log(arg); // outputs 'foo'
});
mockFn.callbackArgs()
The callback args to be invoked by the mock.
Ex:
mockFn.callbackArgs(['foo']);
mockFn(function (arg) {
console.log(arg); // outputs 'foo'
});
MIT
FAQs
Returns a deep copy of an object with all functions converted to spies
The npm package 007 receives a total of 5 weekly downloads. As such, 007 popularity was classified as not popular.
We found that 007 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.