O'Reilly logo

Grunt Cookbook by Jurie-Jan Botha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing tests for a plugin task

The creation of tests forms an essential part of the development of all programming modules, which includes Grunt plugins. Tests provide a way for us to confirm that our tasks work and keep working as expected in a variety of situations.

Getting started

In this recipe, we'll continue to work on the project we created in the Creating a plugin task recipe earlier in this chapter. Be sure to refer to it if you are not yet familiar with its contents.

How to do it...

The following steps take us through creating expected output files and a test suite that checks that the actual output files from the task match them.

  1. Before we get started on creating the actual test suite, we'll create a file called default_options in the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required