es-test-generator

0.1.2 • Public • Published

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-generator

or 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.js

Module 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 func

modulePathExpression: module

Named export

Test File:

export const func = ...

modulePathExpression: module.func

Exported class

Test File:

export class Book ...

modulePathExpression: new module.Book().order

Readme

Keywords

none

Package Sidebar

Install

npm i es-test-generator

Weekly Downloads

2

Version

0.1.2

License

MIT

Unpacked Size

34.1 kB

Total Files

20

Last publish

Collaborators

  • ayankovsky