-
Notifications
You must be signed in to change notification settings - Fork 107
Conversation
…name of saved mock file
Hi @andrewluetgers, thanks for your PR! I don't think we're going to make this change, for now. However I would like to give you feedback anyway:
|
Sorry for the low quality PR.
Its clear there are two things in here that I should have submitted separately. 1: Custom file names 2: prettified JSON
The file gets overwritten but you would have to commit a change and could view the diff and your tests may fail so the issue will rear its head quickly if it is an issue. You would then change the naming scheme and/or your tests. So our front-end Puppeteer testing process looks like this:
|
I'd like this as well (none of the libraries I've found seem to support it!):
A good example of this problem is with OAUTH APIs:
|
@ericclemmons the way I implemented this you provide a function that returns a file name given the request object so this could be easily handled. However I believe nested folder paths would need more coding to support. In my case I just wanted a basic request path as the file name. function mockName(method, url) {
return (method + "|" + url).replace(/\//g, "_").replace("?", "__").replace(/&/g, "--");
}
Replay.uidFn = req => mockName(req.method, req.url.host+ req.url.path) + ".txt"; |
this should be closed IMHO in favor of #162 |
allows user to provide a uidFn option to define how to name mock files.