Skip to content
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

The server will only be stopped, when it returns 2xx status code #299

Open
kyle-chine-leismore opened this issue Feb 22, 2021 · 3 comments

Comments

@kyle-chine-leismore
Copy link

kyle-chine-leismore commented Feb 22, 2021

Bug Report

  • Version: 1.12.0
  • Platform: Ubuntu 20.04 / Node.js 14
  • Expected behavior: The server should be stopped after responding, no matter it is a success or a failure
  • Actual behavior: The server will only be stopped when it returns 2xx status code.

Dear Contributors / Authors

Thanks for your great work. This project is a vital package for my unit test projects.

I am not sure if I did something wrong. But according to my test, this software will only be stopped when the server returns 2xx success status code. In one of my project, my server returns on purpose with a 5xx or 4xx code on some specified condition. I would like to test: 1. If it does returns a proper 4xx or 5xx code; 2. When it does, if it returns with a correct information in message body or HTTP headers.

However, it seems that start-server-and-test will retry the request if the server returns a failure, which makes that it is impossible to test on our error handling part.

I am not sure if this behavior is by designing or not. I am looking forward to hearing from you.

Best regards,

Kyle Chine

@nurbashanghai
Copy link

hi! Did u manage to resolve this issues? Im facing similar problem right now

@nurbashanghai
Copy link

if u look at source code of this library, they checking for status > 200 && status < 300

@kyle-chine-leismore
Copy link
Author

Currently, I have to keep my test code only for 2xx responses. It seems no perfect solution if I don't want to touch the start-server-and-test code itself.

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

No branches or pull requests

2 participants