Book Image

Mastering PhoneGap Mobile Application Development

By : Kerri Shotts
Book Image

Mastering PhoneGap Mobile Application Development

By: Kerri Shotts

Overview of this book

PhoneGap is a useful and flexible tool that enables you to create complex hybrid applications for mobile platforms. In addition to the core technology, there is a large and vibrant community that creates third-party plugins that can take your app to the next level. This book will guide you through the process of creating a complex data-driven hybrid mobile application using PhoneGap, web technologies, and third-party plugins. A good foundation is critical, so you will learn how to create a useful workflow to make development easier. From there, the next version of JavaScript (ES6) and the CSS pre-processor SASS are introduced as a way to simplify creating the look of the mobile application. Responsive design techniques are also covered, including the flexbox layout module. As many apps are data-driven, you'll build an application throughout the course of the book that relies upon IndexedDB and SQLite. You'll also download additional content and address how to handle in-app purchases. Furthermore, you’ll build your own customized plugins for your particular use case. When the app is complete, the book will guide you through the steps necessary to submit your app to the Google Play and Apple iTunes stores.
Table of Contents (19 chapters)
Mastering PhoneGap Mobile Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Integrating our tests with Gulp


So far, we've executed our tests manually using environment variables and mocha. It would be nice if we could use gulp to execute our tests instead, right?

Thankfully, that's really pretty simple. First, we need to install a plugin that integrates Gulp and Mocha:

npm install --save-dev [email protected]

Then, we need to add a line to the top of gulpfile.js, if you haven’t already done so:

require("babel/register"); // enable ES2015 in our tests

We also need to add a few configuration settings to the config object in gulp/config.js:

var config = {
    …
    test: {
        code: "test/*.js",
        ui: "test-ui/*.js"
    },
}

These configuration settings will be used in our testing tasks to indicate the JavaScript files that should be considered as tests. Notice that our code and UI automation tests live in different directories.

Next, we need to add a new task executes our code tests. Let's call it gulp/tasks/test.js:

"use strict";

var gulp = require("gulp"),
  ...