Giter VIP home page Giter VIP logo

Comments (8)

dscape avatar dscape commented on July 21, 2024

Or you could generate code files

require('nock')

nock.record(function (js_file) {
  do_whatever(js_file);
}, 5000)

Meaning when 5 seconds pass call the callback with the current js file

from nock.

pgte avatar pgte commented on July 21, 2024

You have

nock.restore()

to do that.

No dia 2 de Dez de 2011, às 02:35, Nuno Job
[email protected]
escreveu:

Simply require nock and all should work.

Nock could save tests on the first run to the file system. Then replay wouldn't be done cause it was nocked.

A way to invalidate bad results would be necessary, so max a user would do is

nock.rewind();

Reply to this email directly or view it on GitHub:
#14

from nock.

pgte avatar pgte commented on July 21, 2024

Sorry, didn't read, think this is a good idea!

No dia 2 de Dez de 2011, às 02:35, Nuno Job
[email protected]
escreveu:

Simply require nock and all should work.

Nock could save tests on the first run to the file system. Then replay wouldn't be done cause it was nocked.

A way to invalidate bad results would be necessary, so max a user would do is

nock.rewind();

Reply to this email directly or view it on GitHub:
#14

from nock.

pgte avatar pgte commented on July 21, 2024

Also, see #62

from nock.

ierceg avatar ierceg commented on July 21, 2024

I have a helper module that does something similar. But in general case nocks need some processing (e.g. when data contains random or variable data like timestamps).

Here is a gist with code and in use. If there is interest I could extend recorder to have this kind of functionality.

from nock.

kelaban avatar kelaban commented on July 21, 2024

I put in a PR with my idea of how to re use nocks in a VCR like fashion. It makes recording and playback seamless instead of having to manually output and save json objects.

from nock.

ierceg avatar ierceg commented on July 21, 2024

@kelaban's PR with the said functionality has been merged into master.

from nock.

lock avatar lock commented on July 21, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue and add a reference to this one if it’s related. Thank you!

from nock.

Related Issues (20)

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.