Skip to content
ACA Mobile edited this page Dec 7, 2016 · 4 revisions

Installation

 "devDependencies": {
    "tiunit": "git+ssh://github.com/aca-mobile/ti-unit.git#1.0.0",

or

npm install git+ssh://github.com/aca-mobile/ti-unit.git#1.0.0 --save-dev
  • create 'spec' folder in the root of your project (folder with tiapp.xml)
  • place all your test files inside this folder, the filenames of test files must end with _spec.js

Execute your tests

To execute your tests, simply execute the jasmine command from within the root folder of your project

Mocking the Ti namespace

The framework generates a mock for the whole Ti namespace, based on api.jsca. The mock can be generated on the embedded api.jsca but also on your own version of api.jsca.

Get the Ti namespace from the enclosed api.jsca

Ti = require('tiunit/jsca.api.parser').parse();

Get the Ti namespace from your own api.jsca

Ti = require('tiunit/jsca.api.parser').parseFromConfig();

If you want to use your own api.jsca, the path (folders only) to your local api.jsca configuration must be configured in support/parser.json:

{
  "path": "/Applications/Appcelerator\\ Studio/plugins/com.appcelerator.titanium.core_3.1.2.1447384916/resources/jsca"
}

(it's best to exclude parser.json in your .gitignore file)