mock-knex icon indicating copy to clipboard operation
mock-knex copied to clipboard

Add recorder much like nock has.

Open CodisRedding opened this issue 8 years ago • 3 comments

I was thinking that it would be a useful addition to add a .record() function, that would record the unmocked db calls and output the mock-knex code needed to mock those same calls.

CodisRedding avatar Aug 18 '16 01:08 CodisRedding

Is this what your thinking? https://github.com/node-nock/nock#recording, if so looks like an interesting feature.

jbrumwell avatar Aug 18 '16 02:08 jbrumwell

Yeah. That's it. It's been really useful for http calls. When I find some time I'd like to explore it a bit.

CodisRedding avatar Aug 18 '16 02:08 CodisRedding

That would be great :) you could use knex's query-response event, which should give you the sql query and the expected response :+1:

jbrumwell avatar Aug 18 '16 02:08 jbrumwell