
Product
Secure Your AI-Generated Code with Socket MCP
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
jest-test-gen
Advanced tools
Generator of jest unit test with all imports mocked and tests stub for every class and function exported
The VS Code extension is the fastest way to generate a unit test file from a source file directly from the IDE
Install jest-test-gen Extension
Automates creation of initial unit test files taking dependencies into account.
Parsing and test generation is avaialable for the following exports:
This tool will take a js/ts file as input and generate a jest unit test file next to it with all imports mocked and tests stubs for every class method and function exported.
This project is inspired and started as a fork of jasmine-unit-test-generator
Basic ES6 Class example:
React Component example:
run npm i -g jest-test-gen
run jest-test-gen <path-to-file>
It's probably best to:
spec/fixtures
folder test.jsintegration.spec.ts
Alternavely, you can:
npm link
npm run build:dev
jest-test-gen <option>
in your project of choicerun npm run build
run npm publish
v1.4.3
export as
syntax
Thanks @yimingheFAQs
Generator of jest unit test with all imports mocked and tests stub for every class and function exported
The npm package jest-test-gen receives a total of 222 weekly downloads. As such, jest-test-gen popularity was classified as not popular.
We found that jest-test-gen 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.
Product
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NISTβs handling of the National Vulnerability Database.
Research
Security News
Socketβs Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.