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.
A command-line interface testing extension for jest.
shellshot
?The main purpose of shellshot
is running end2end tests for command-line applications. By providing a speaking API, it is also suited for non-javascript applications and is actually meant to be used for all types of command-line applications.
stdout
, stderr
, and the exit code
of the applicationjest
all of the well known testing API can be used with shellshot
jest
shellshot
in your current directory$ npm install shellshot
This will create a node_modules
folder containing all dependencies for shellshot
including jest
. Make sure to add node_modules
to your .gitignore
. The package-lock.json
file should also be added to your .gitignore
.
To run jest
tests in your current folder you need to create a jest
configuration:
$ touch jest.config.js
You can leave the config empty for now.
Now create a new file awesome.test.js
with the following content:
const { setup } = require('shellshot');
setup();
it(
'should run my first shellshot test',
async () => {
await expect.command('ls -l')
.forStdout(expectation => expectation.toContain('jest.config.js'))
.forExitCode(expectation => expectation.toBe(0));
},
);
Now run lets run your first test:
$ ./node_modules/.bin/jest
PASS ./awesome.test.js
✓ should run my first shellshot test (12ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 0.863s
Ran all test suites.
Have a look at the examples folder for more examples.
FAQs
A command-line interface testing extension for jest
We found that shellshot 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
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.