Coder Social home page Coder Social logo

mockbuilder's Introduction

#Mock Builder

This project takes HTTP Archive Files (.har) and translates them into Sinon.js Ajax Mocks.

Get the HAR files from the Chrome Developer Tools network panel. After your browser has generated some traffic, you can right click in the transaction log and select "Save as HAR with Content". Save the files into the "hars" subfolder. This project translates those HAR files into Mock requests which could be useful for things like unit tests. The translated mocks will be put into the "mocks" folder with the same name as the .har file.

##How to install

Install as a standard node package

npm install

Using the command line from this folder, execute this command:

grunt

This will enable the folder monitoring process, allowing new and changed .har files to be automatically translated into mocks.

##Configuration

all config changes can be made to: config.js

###url

When making requests to a local server, the base url that sinon expects will be /. You can edit config.js to switch the url to be whatever the external url was. So if you grab your mocks from "example.com" and have the url set to that in the config, sinon will then treat any calls to "example.com/foo" as calls to "/foo".

###outputLocation

To automatically copy the mocks into a folder in your application, you can modify outputlocation to save to anywhere you would like.

mockbuilder's People

Contributors

jakefeasel avatar huckelliott avatar

Stargazers

Ernst Salzmann avatar Joseph Le Brech avatar  avatar

Watchers

James Cloos 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.