Giter Club home page Giter Club logo

yosapy's Introduction

yoSapy Build Status Code Climate Test Coverage Dependency Status

AngularJS test generator. It's an yeoman generator. Generates customized Jasmine test for your angularJs file [Right now only works for controllers . test generator for directives and services are under construction...]

  • Takes path of the angularJs file to be tested as input.
  • Parses the file and generates a test file.
  • Be ready for surprise - you will be amazed to see that most of these auto generated test are actually passing , and you need to edit rest, to make them pass (Obviously ).
  • this auto generated test file takes your code coverage for that file from 0% to 40-50% without writing a single line of code . Now that's Freaking awesome!!!

Usage

globally install the module

npm install -g generator-yosapy
  1. Now go to the test folder in your Angular project, where you want the test file to be created.
cd ~/path/To/Your/Test/Folder/
  1. Now run following command. ( It's a yeoman generator so you need to have yeoman installed)
yo yosapy
  1. It will prompt you for the path of the file to be tested. Provide absolute path of the file.
?Absolute path of the File to be tested: absolutePath/of/file/myController.js
  1. This generator will parse your file and genearte a test file for you .

Caveat

This generators parses your file using and Esprima and Regex, and to produce meaningful, mostly passing , custom testcases , I had to make a hell lot of assumptions and even hell lot more fallBacks. here are some tips to help the generator not to fail with weired error messages for your input file.

  • Only tested this on Mac . Might fail for other Operatiing System (specially windows)
  • Please ensure your input file is not having syntactical error (e.g passes JSLint)
  • Your input file should contain a single component (It should not have more than one controlers or directive clubbed in a single file.)

Support

This generator not working at all ? or generating gibberish ? then Probably the some of my "assumptions" (to be specific regex and ast-queries) need to be refined . Feel free to shoot a mail at [email protected] with input.js file and I will be happy to help .

yosapy's People

Contributors

sap9433 avatar

Watchers

Prayag Verma  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.