Automation testing
By integrating the power of gulp plugins and gulp task together, we can create a flow of consecutive tasks that can run parallel or sequentially as per our requirements. Though we have the gulp task dependency feature, we are going to use the npm run-sequence module to run the task in sequence. This helps us to structure the task easily and reduce the complexity when the number of tasks increases over time.
Run the following command to install run-sequence:
npm install run-sequence --save-devWith respect to its usage, the only thing we need to remember is that every gulp task should either return a stream or promise, or should be handled using callback. Let's justify this statement and leverage the power of gulp automation by creating three simple tasks in a flow:
- Start our hapi app.
- Test the API of the hapi app. While testing, make sure the
test-node-appdirectory is present at the root level ofgulpfile.js. Refer to the Chapter 10, Configuring the Task Runner Using JSON...