Code Monkey home page Code Monkey logo

inakiabt.ti-module-tester's Introduction

Titanium Module Tester

A simple Gruntfile.js to test your "titaniumified" common js and iOS (Android coming soon) native modules in two commands using TiShadow (tishadow spec for more information about run tests with TiShadow -> here)

The basics

Just clone this repo in your module folder and install dependencies:

git clone https://github.com/inakiabt/ti-module-tester
cd ti-module-tester
npm install

Run this:

grunt

...and that's it!

In case you want to test iOS native modules, just add this to your module package.json:

{
  "name": "your-module-name",
  "version": "your-version", // It must match with the version in your manifest file
  "titaniumManifest": {
    "type": "iphone"
  },
  ...
}
In case you don't want to clone this project in your project, you can clone it anywhere and use --module-dir /path/to/your/module param.

How it works

This Gruntfile.js provides some tasks to setup a temp Titanium app and test your module with it using TiShadow.

Tasks provided:

grunt [default]

It will:

Required for setup the environment

grunt test

It will:

  • Update/copy your module specs
  • Run tishadow spec in the temp app

Useful when you are developing the module specs

grunt module:setup

It will:

  • Build your titaniumified module
  • Install your module in the temp app
  • Appify the app
  • Build the app

Useful when you make changes on your module

Example

utils-module/
   utils.js
   package.json
   spec/
      utils_spec.js
   ti-module-tester/

utils.js

exports.sum = function(value1, value2){
  return value1 + value2;
};

spec/utils_spec.js

var utils = require('utils');
describe('utils module', function(){
  it("should return a + b", function () {
      var a = 10, b = 30;
      expect(utils.sum(a, b)).toEqual(a + b);
  });
});

After setup the environment, running grunt test I'll get something like this:

Author

Iñaki Abete web: http://github.com/inakiabt email: [email protected] twitter: @inakiabt

Contribute

Found a bug? Want to contribute and add a new feature?

Please fork this project and send me a pull request!

License

This library, ti-module-tester, is free software ("Licensed Software"); you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; including but not limited to, the implied warranty of MERCHANTABILITY, NONINFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

inakiabt.ti-module-tester's People

Contributors

inakiabt avatar etruta avatar

Watchers

Brenton House avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.