Skip to content

Warn on second new Pretender #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

trek
Copy link
Member

@trek trek commented Aug 25, 2016

Not everyone is diligent about shutting down their Pretenders. This will prevent a second instance from starting up.

@coveralls
Copy link

coveralls commented Aug 25, 2016

Coverage Status

Coverage decreased (-23.3%) to 75.13% when pulling c6d088c on warn-on-second-pretender into 1d451d8 on master.

@trek trek force-pushed the warn-on-second-pretender branch from c6d088c to 4c0e93a Compare August 25, 2016 16:40
@coveralls
Copy link

coveralls commented Aug 25, 2016

Coverage Status

Coverage increased (+0.02%) to 98.446% when pulling 4c0e93a on warn-on-second-pretender into 1d451d8 on master.

@trek trek mentioned this pull request Aug 25, 2016
@fotinakis
Copy link

❤️ LGTM!

@@ -237,6 +237,11 @@ function interceptor(pretender) {
};

FakeRequest.prototype = proto;

if (nativeRequest.prototype._passthroughCheck) {
throw new Error('You created a second Pretender instance while there already one running. ' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text here reads a tad odd to me, maybe:

You created a second Pretender instance while there was already one running.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He's saying that the "while there already one running" needs a "was" in there.

@rwjblue
Copy link
Contributor

rwjblue commented Aug 25, 2016

I'm not 100% familiar with what happens today if you do this. If things continue to work in this scenario we should change this to a warning (or bump majors).

@trek
Copy link
Member Author

trek commented Aug 25, 2016

@rwjblue If you start new instances while a previous one is running, all new xhr requests go to the most recently created instance, which leads to unexpected routing. If you lose track of the first one you started, you can never restore the native XMLHttpRequest object.

Happy to bump majors though to avoid breaking.

@fotinakis
Copy link

👍 to the major bump, makes sense.

@trek trek closed this Oct 6, 2016
@trek
Copy link
Member Author

trek commented Oct 6, 2016

Closing to do a small fixup.

@rwjblue rwjblue mentioned this pull request Oct 13, 2016
carols10cents added a commit to bjornharrtell/crates.io that referenced this pull request Feb 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants