Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
(c)Bumblehead
This package must be used with node's experimental --loader,
ava --node-arguments="--loader=esmock"
mocha --loader=esmock
Add the command to your package.json,
{
"name": "my-module",
"type": "module",
"scripts" : {
"unit-test": "ava --node-arguments=\"--loader=esmock\""
}
}
And use it
import test from 'ava';
import esmock from 'esmock';
test('should mock module and local file at the same time', async t => {
const main = await esmock('./local/main.js', {
'astringifierpackage' : o => JSON.stringify(o),
'./local/util.js' : {
exportedFunction : () => 'foobar'
}
});
t.is(main(), 'foobar, ' + JSON.stringify({ test: 'object' }));
});
FAQs
provides native ESM import and globals mocking for unit tests
The npm package esmock receives a total of 18,315 weekly downloads. As such, esmock popularity was classified as popular.
We found that esmock 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.