Book Image

Getting Started with Grunt: The JavaScript Task Runner

By : Jaime Pillora, Bocoup LLC
Book Image

Getting Started with Grunt: The JavaScript Task Runner

By: Jaime Pillora, Bocoup LLC

Overview of this book

Table of Contents (12 chapters)

Testing with Grunt


Performing automated tests is another major use case for Grunt. Let us say our build process involves compiling, analyzing, optimizing, and then deploying our application. This sequential nature of Grunt is useful because if any link in the above process fails, Grunt will not proceed, that is, any subsequent tasks will not be run. This is important because it prevents our analysis tasks from running when our build tasks fail to create the files that we need to analyze. However, static analysis won't spot logical errors in our build files, therefore we may still be deploying a buggy application despite a successful build. We can work towards preventing this by including a test suite to our application –placing our new test task before our deploy task. Even if we have a Quality Assurance (QA) team, which manually tests our application, using a test suite can save QA iterations by quickly catching logic errors.

A test suite is also useful for trapping regression errors. Our...