Skip to content

An API fixtures generator spying fetch requests to generate response files.

License

Notifications You must be signed in to change notification settings

dldl/api-fixtures-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Fixtures generator

This is a super lightweight library to generate fixtures files from all fetch requests performed by your frontend. Files are immediately downloaded to your computer.

You can then use them, for instance, to mock your API calls and perform functional testing of your application.

Usage

Install the lib:

npm install --save-dev @dldl/api-fixtures-generator

Use the lib, for instance in your index.js file (the file should be loaded before any other library so the fetch function is replaced effectively everywhere in your app):

import "@dldl/api-fixtures-generator"

// Your application code

You may conditionally load the library based on the NODE_ENV environment variable to only load this in testing (for instance by using an already generated fixture file or by generating it on the fly like Netflix/pollyjs would do).

About

An API fixtures generator spying fetch requests to generate response files.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published