es-test-generator v0.1.2
ES Test Generator
An automatic Jest test suite generator utilizing the ExpoSE symbolic executor.
This project is currently in a proof of concept state. Feel free to report any issues and submit pull requests.
Prerequisites
- Docker
Installation
npm i -g es-test-generatoror just let node install it using npx
Usage
npx es-test-generator generate rootDir testFile modulePathExpression outputFile [argsNumber]rootDir - Root directory of the project
testFile - File to import test function from, relative to the project root
modulePathExpression - A JavaScript expression generator will use to locate the test function.
See module path expression examples
outputFile - Path to the output test suite
argsNumber - optional A number of arguments passed to the tested function
Example:
npx es-test-generator generate . test-file.js module ./output.test.jsModule Path Expression
A JavaScript expression generator will use to locate the test function.
The generator needs to know which export function/method you want to test.
Default export
Test File:
const func = ...
export default funcmodulePathExpression:
module
Named export
Test File:
export const func = ...modulePathExpression:
module.func
Exported class
Test File:
export class Book ...modulePathExpression:
new module.Book().order