Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26093] Integrate Karma unit test runner into SDK

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionDuplicate
Resolution Date2019-06-04T18:53:49.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsCLI, Tooling
Labelsn/a
ReporterJan Vennemann
AssigneeJan Vennemann
Created2018-06-05T13:25:08.000+0000
Updated2019-06-04T18:53:49.000+0000

Description

This ticket is about integrating the [titanium-karma-runner](https://github.com/appcelerator/titanium-karma-runner) into the SDK. Ideally we should go with an approach like the following: * The above standalone Titanium Karma runner app is intended for testing libraries that are not part of any Appc project, like [titanium-vdom](https://github.com/appcelerator/titanium-vdom) for example. * For app and module projects, Introduce a new test command that will run unit tests using the Titanium Karma client. This could either be a new flag to the run command like appc run --unit or a separate command like appc test. What needs to be done: * (/) Bundle the Titanium Karma client and place it somewhere in the SDK so it can replace a project's default app.js during unit testing. (Implemented as a node module here: [titanium-karma-client](https://github.com/appcelerator/titanium-karma-client)) * Implement the appc test command. This will start a local Karma server, build the project with the altered app.js, then launches the app and passes the URL of the Karma server so tests can be executed. * (/) Create the karma-titanium-launcher which will start test run execution by passing the Karma server URL to the build testing app. (Implemented as a Karma plugin: [karma-titanium-launcher](https://github.com/appcelerator/karma-titanium-launcher)) * Nice to have: Maybe integrate with device farms?

Comments

  1. Jan Vennemann 2018-08-03

    [~emerriman], this can currently be used independently of the SDK via npm scripts. Example projects that already use the Karma unit testing are [titanium-vdom](https://github.com/appcelerator/titanium-vdom) and [titanized](https://github.com/appcelerator/titanized) (also includes end-to-end tests with Appium and Webdriver.io). What todo next here is: * Add more examples about the usage in TIMOB-26254 * Evaluate Karma setup for app and module projects. The projects that already use Karma unit testing are node packages with a TypeScript source code base. App and module projects will need a different setup to work well. Currently i would refrain from introducing a new CLI command like appc run --unit or appc test because unit testing can easily be started with npm run scripts. Also it gives the user more control over how they want to configure their tests and which tools to use.
  2. Jan Vennemann 2019-06-04

    Closing this in favor of TIMOB-27129

JSON Source