0.8.1 • Published 2 years ago

karma-titanium-launcher v0.8.1

Weekly downloads
132
License
Apache-2.0
Repository
github
Last release
2 years ago

karma-titanium-launcher

Greenkeeper badge

Run your unit tests inside Axway Titanium.

Installation

Simply install this launcher as a dev dependency to your existing project:

npm i karma-titanium-launcher -D

This module also requires the titanium CLI to be installed globally in order to create temporary test projects and automatically downloading SDK versions. You can do so with:

npm i titanium -g

💡 iOS Testing Note: Version 0.7.0+ of this launcher requires Xcode 10.2 / Swift 5+. If you're still on Swift 4 use version 0.6.0 of this launcher.

Usage

This launcher is for testing Titanium apps and native modules as well as plain JS libraries intended to run inside the Titanium runtime. It is typically used in CI to run tests on different platforms. However, it also supports an expirmental rapid TDD setup which allows you to run tests as you write your code.

Configuring this launcher

To configure this launcher you have to create customLaunchers and set them in the browsers option in your Karma configuration.

module.exports = config => {
    config.set({
        // ...
        customLaunchers: {
            ios: {
                base: 'Titanium',
                browserName: 'iPhone Simulator',
                platform: 'ios',
                sdkVersion: '8.0.0.GA'
            },
            android: {
                base: 'Titanium',
                browserName: 'Android Emulator (Nexus 5X)',
                platform: 'android',
                flags: [
                    '--device-id', 'Nexus_5X_API_27'
                ]
            }
        },
        browsers: ['android', 'ios']
    });
}

You can select the platform you want to test with the platform option. This will prepare your project for unit testing with Karma and launch the basic titanium build -p [platform] command.

Please refer to the following table for a full list of available options.

NameTypeDescription
platformStringSpecifies the target platform where your unit tests should be run.
flagsArrayAdditional flags to pass to the build command. Refer to titanium build --help for a list of available options.
sdkVersionStringThe SDK version used to build the test runner. Defaults to the <sdk-version> of your tiapp.xml (only in app projects) or the currently selected SDK within the titanium CLI (check ti sdk list)

You can also set certain global options that apply to all custom launchers you configure. Global options can be overridden by the individual launcher configuration.

module.exports = config => {
    config.set({
        titanium: {
            sdkVersion: '8.0.0.GA'
        }
    });
};

Supported global options:

NameTypeDescription
sdkVersionStringThe SDK version used to build the test runner. Defaults to the <sdk-version> of your tiapp.xml (only in app projects) or the currently selected SDK within the titanium CLI (check ti sdk list)

Example projects

For example projects that are using this launcher checkout appcelerator/titanium-vdom, appcelerator/titanized or the titanium-socketio native module.

Contributions

Open source contributions are greatly appreciated! If you have a bugfix, improvement or new feature, please create an issue first and submit a pull request against master.

Getting Help

If you have questions about unit testing your Titanium apps or libraries with Karma, feel free to reach out on Stackoverflow or the #helpme channel on TiSlack. In case you find a bug related to this library, create a new issue or open a new JIRA ticket.

License

Apache License, Version 2.0

0.9.0-1

2 years ago

0.8.1

3 years ago

0.8.0

3 years ago

0.7.8

4 years ago

0.7.7

4 years ago

0.7.6

4 years ago

0.7.5

5 years ago

0.7.4

5 years ago

0.7.3

5 years ago

0.7.2

5 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.6.0

5 years ago

0.5.6

5 years ago

0.5.5

5 years ago

0.5.4

5 years ago

0.5.3

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago