In Node.js, how would you write a unit test page speed?

I'm working on a site replatform/redesign. We are going to use Node.js and Hapi. I would like to add unit test that will measure page load speed. Is there a way to do this using Mocha and Chai? Are there any frameworks that are dedicated to page speed testing specifically?

As @Mansfield mentioned what you're looking for is a integration test and not a unit test.

I'd recommend using phantomjs and review the HAR data that's available which will show you time to first byte, and other end user experience metrics.

Here's a link to one of the examples: loadspeed.js computes the loading speed of a web site

And here's one on the HAR data: netsniff.js captures network traffic in HAR format

If you are not familiar with HAR data - then think of what you see in firebug or Chrome's network tab. You can upload the HAR file into viewers on the web like this one

When you test you'll want to put some traffic to your application and as previously mentioned by @Alvin K. AB can send a bunch of requests to a page to simulate some load on the app.

For a more "node" approach than Apache's AB tool there's wrk - Modern HTTP benchmarking tool.