node-replay icon indicating copy to clipboard operation
node-replay copied to clipboard

Example for custom file name

Open Nogbit opened this issue 10 years ago • 5 comments

In the readme you say The file name is a timestamp, but feel free to rename it to something more rescriptive.

However, I don't see where this is possible. I'm trying to use this within mocha tests and would like to explicitly set the filename so that I have control of the fixture content in a CI environment to use scrubbed data. The tests do not use request, however, the library that is under test wraps up request as needed by the library.

Nogbit avatar Mar 06 '15 00:03 Nogbit

Depends on your OS. On Linux and OS X you can use the mv command.

assaf avatar Mar 06 '15 01:03 assaf

I was referring to something built in. In a similar way that nock permits.

Nogbit avatar Mar 06 '15 04:03 Nogbit

You can change where the fixtures are stored by setting Replay.fixtures

assaf avatar Mar 06 '15 04:03 assaf

Assaf, I think the poster means instead of the name 152063271234878036, it might be nice to have a name derrived from the test name or maybe the request URL.

Like if the first line of the file is: POST /api/v1/reservations/636550145738914944/confirm?restaurantId=041OGGZK4

Might use something like https://www.npmjs.com/package/slugify to generate something like this: POST_api_v1_reservations_636550145738914944_confirm__Q__restaurantId__EQ__041OGGZK4

ggb667 avatar Mar 12 '18 12:03 ggb667

I'm interested in forking project and implement feature of "slugified" fixtures names if nobody working on it. I think could be really an interesting feature.

xblaster avatar Apr 12 '18 09:04 xblaster