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

feat: Simplify supertest-koa bootstrap #163

Merged
merged 6 commits into from
Jul 24, 2020
Merged

Conversation

runk
Copy link
Contributor

@runk runk commented Jul 24, 2020

Don't start the server and avoid the need to stop it.

app.callback()
Return a callback function suitable for the http.createServer() method to handle a request. You may also use this callback function to mount your Koa app in a Connect/Express app.

@runk runk requested a review from a team as a code owner July 24, 2020 00:46
@changeset-bot
Copy link

changeset-bot bot commented Jul 24, 2020

🦋 Changeset is good to go

Latest commit: 72f5d31

We got this.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@72636c 72636c left a comment

Choose a reason for hiding this comment

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

Well isn't that simple, thanks 🤦


return Object.assign(getAgent, { setup, teardown });
const agent: request.SuperTest<request.Test> = request.agent(app.callback());
return () => agent;
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should just return agent directly from all these helpers? That way we can just do agent.do() rather than agent().do()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@72636c 72636c merged commit aaae12a into master Jul 24, 2020
@72636c 72636c deleted the no-agent-setup-teardown branch July 24, 2020 03:22
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.

None yet

3 participants