Skip to content
This repository has been archived by the owner on Feb 22, 2019. It is now read-only.

"feature" request: restart server for each test #5

Open
jamesarosen opened this issue May 7, 2015 · 3 comments
Open

"feature" request: restart server for each test #5

jamesarosen opened this issue May 7, 2015 · 3 comments

Comments

@jamesarosen
Copy link

Currently, this library starts the server before the suite run and stops it after.

That leads to the situation where server.responses and server.requests have shared state from test to test. That, in turn, makes it harder to make assertions about requests and responses and makes it easy to accidentally have one test step on another by defining a fake response.

What do you think of changing the above lines to the following?

QUnit.testStart(startServer);
QUnit.testDone(stopServer);
@jamesarosen
Copy link
Author

Or would that mess with the library's ability to record?

@andremalan
Copy link
Contributor

@jamesarosen the biggest reason that it doesn't do that right now is that it allows the recorder to memoize recordings from other steps. So for instance if your app requests /users for every test, having it not restart means that we can then only make one request to the server while recording. It also means that you have better guarantees, if the request changes during recording, a newer result won't clobber an old one.

@jamesarosen
Copy link
Author

I've long since forgotten my original reason for writing this. I wonder if I meant to do the stop and restart only in playback mode.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants