@opifex/jest-test-generator v0.3.2
GPT Powered Jest Tests Generator
Generates Jest tests cases: 1 base case, 1 edge case, and 1 error case. Supports JavaScript and TypeScript. Test are generated in same directories as source files as filename.test.extension files. If such file already exists, append new tests to it.
Attention: Requires account on Opifex.ge to be used.
Setup
npm i jest-test-generator
\
And add script to package.json e.g.
"scripts": {
"generate-test-for-utils": "jest-test-generator ./src/utils"
}
Or globally to use it as a command line tool npm i -g jest-test-generator
Authentication
jest-test-generator login
And provide your credentials and you will be logged in.
Or if you already have a token you can use it directly jest-test-generator jwt <token>
Usage
Argument \
target
: file, files or directory to generate tests for
Option \
-c, --no-cache
: do not cache functions, cached functions are skipped. (default: true
) \
-f, --full
: use full files as an input for the generator, instead of per function, caching does not work in this mode. (default: false
) \
-v, --verbose
: print more information (default: false
) \
Note: By default it extracts functions from files and processes them one by one. use -f flag to process files as a whole.
Note: Processing whole project at once is not recommended, it will take a lot of time and resources. Prefer to use it on a per file basis or per small directory basis.