
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.
mock-nanoid
Advanced tools
Simple module meant to mock nanoid methods in a deterministic, sequential way for testing purposes.
Simple module meant to mock nanoid methods in a deterministic, sequential way for testing purposes.
import { nanoid } from 'nanoid/non-secure'
nanoid(5); // "V1StG"
Now you would do:
import { mockNanoid as nanoid } from 'mock-nanoid/non-secure';
nanoid(5); // '00000'
nanoid(5); // '00001'
nanoid(3); // '000'
nanoid(3); // '001'
nanoid.resetMock(5); // clears only length 5
nanoid(3); // '002'
nanoid(5); // '00002'
For mocks not yet built, we just re-export nanoid's functions.
To do this in jest:
// jest.config.mjs
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
export default {
// ...your configurations here
moduleNameMapper: {
// ...your other mocks here
'nanoid': require.resolve('mock-nanoid'),
'nanoid/non-secure': require.resolve('mock-nanoid/non-secure'),
},
};
FAQs
Simple module meant to mock nanoid methods in a deterministic, sequential way for testing purposes.
The npm package mock-nanoid receives a total of 2 weekly downloads. As such, mock-nanoid popularity was classified as not popular.
We found that mock-nanoid demonstrated a healthy version release cadence and project activity because the last version was released less than 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.