Functional Testing without starting server
See original GitHub issueHow do I send a request to KOA app without starting the server
I want to avoid app.listen(port)
I am looking for something like
yield koaApp.sendRequest("POST", "/login/user", {
username : "svsf",
passwd : "XXXX"
}, {
someHeader: "header Value"
})
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Testing a web application without web server - Stack Overflow
To completely test the web application without tomcat or jetty server, the web server behavior has to be simulated.
Read more >The different types of testing in software | Atlassian
Functional tests focus on the business requirements of an application. They only verify the output of an action and do not check the...
Read more >3 ways to write function tests for Liberty - IBM Developer
There are many ways to write function tests for WebSphere Liberty and Open ... (or another IDE) without first manually starting the server....
Read more >Testing - hapi.dev
To this end, Hapi includes the ability to test routes without having to actually start a server, completely avoiding the time overheads and...
Read more >A Node.js Guide to Actually Doing Integration Tests - Toptal
Your software isn't fully tested until you write integration tests for it. While unit tests help ensure that functions are properly written, integration ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah
listen(0)
seems to be how a lot of testing frameworks do it under the hood. Not sure there’s any downside to it.app.listen
certainly does not block, I think the problem is elsewhere.To answer your original question though, I think this might work:
app.callback()(req, res);
(you’ll probably want to store
app.callback()
somewhere after you’ve added in the middleware, calling that calls compose on the middleware)app.callback()
works like a charm. Many thanks.