Writing Testable Application in AngularJS – Part 5

Throughout the series, we’ve seen how powerful AngularJS is and how quickly you can write unit tests for your application. In this post, we’ll take a look at grunt .

To create a build, simply execute:

$ grunt build

Above command does a lot of things such as run all tests, compile sass/compass files, minification of css and js, etc.

In our case, we’ve to do slight modifications in Gruntfile.js. If you want to include directories/files which were not created by the generator but to be needed in dist then just locate copy option in Gruntfile.js and add it in src array.

    copy: {
      dist: {
        files: [{
          src: [
            // including data/ directory

And at the bottom under grunt.registerTask('build') option, you can comment/remove tasks to be omitted during the build.

  grunt.registerTask('build', [
    // Do not require below tasks
    // 'jshint',
    // 'test',
    // 'coffee',

Grab source code

I really enjoyed writing this series and hope you like it. You can grab the source code from github. or checkout the working demo.

If you found this article useful in anyway, feel free to donate me and receive my dilettante painting as a token of appreciation for your donation.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.