Skip to content
This repository was archived by the owner on Dec 16, 2023. It is now read-only.

Example for custom file name #59

Open
Nogbit opened this issue Mar 6, 2015 · 5 comments · May be fixed by #162
Open

Example for custom file name #59

Nogbit opened this issue Mar 6, 2015 · 5 comments · May be fixed by #162

Comments

@Nogbit
Copy link

Nogbit commented Mar 6, 2015

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.

@assaf
Copy link
Owner

assaf commented Mar 6, 2015

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

@Nogbit
Copy link
Author

Nogbit commented Mar 6, 2015

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

@assaf
Copy link
Owner

assaf commented Mar 6, 2015

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

@ggb667
Copy link

ggb667 commented Mar 12, 2018

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

@xblaster
Copy link

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.

mweibel pushed a commit to mweibel/node-replay that referenced this issue Feb 7, 2019
@mweibel mweibel linked a pull request Feb 7, 2019 that will close this issue
mweibel pushed a commit to mweibel/node-replay that referenced this issue Feb 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants