ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonenko Alexander (JIRA)" <>
Subject [jira] [Updated] (AMBARI-5411) Karma integration.
Date Wed, 09 Apr 2014 17:32:17 GMT


Antonenko Alexander updated AMBARI-5411:

    Attachment: AMBARI-5411.patch

> Karma integration.
> ------------------
>                 Key: AMBARI-5411
>                 URL:
>             Project: Ambari
>          Issue Type: Task
>          Components: client
>    Affects Versions: 1.6.0
>            Reporter: Antonenko Alexander
>            Assignee: Antonenko Alexander
>             Fix For: 1.6.0
>         Attachments: AMBARI-5411.patch, karma-snapshot-1.png, karma-snapshot-2.jpeg
> Add [Karma|] as additional tool for running
FE tests. Karma provides great functionality and powered with a lot of useful plugins. It
can improve testing experience and prevent bugs appearing before pushing your changes to git
> h2. Setup
> First of all there are no changes to testing with *mocha-phantomjs* and additional packages
doesn't break any compatibility with dev and build tools.  
> You need *node.js* >= 0.10. I recommend to install node.js by [nvm|](Unix
> Install required packages. Run after patch applying:
> {noformat}$ npm install {noformat}
> Now you have installed Karma in *node_modules/* folder. If you want to install Karma
globally run:
> {noformat}$ npm i -g karma@0.11.14{noformat}
> Run karma from *project_root/ambari-web/* folder:
> {noformat}
> # for locally installed Karma
> $ node_modules/karma/bin/karma start
> # for globally installed Karma
> $ karma start
> {noformat}
> This command will run karma server on http://localhost:9876 and repeat tests while files
> PhantomJS is default browser for running, but you can open http://localhost:9876 in any
browser which will run tests also. 
> To generate coverage summary edit *project_root/ambari-web/karma.conf.js*:
> {noformat}
> ...
> preprocessors: {
>      '!(vendor|node_modules|test)/**/!(karma_setup|tests).js': 'coverage', // uncomment
this line
>       'app/templates/**/*.hbs': ['ember-precompiler-brunch', 'common-require'],
>       'app!(assets)/**/!(karma_setup|tests).js': ['common-require'],
>       'test/**/*.js': ['common-require']
>     },
> ....
> reporters: ['progress','coverage']
> {noformat}
> Look to *project_root/ambari-web/public/coverage/*. You can setup custom path in #coverageReporter
config property.
> If you have problems with PhantomJS disconnecting, install it from [download page|]
and set shell variable *PHANTOMJS_BIN* with path to executable file (by default is */usr/bin/phantomjs*).
You can add this variable to your shell profile file, or make it session only by: {noformat}$
export PHANTOMJS_BIN=/usr/bin/phantomjs{noformat}
> h3. Windows Setup
> Tested with node.js v 0.10.20
> You need to install, if not installed:
> - [Visual C++|]
> - [Python 2.6|]
> - [Node.js|]
> h2. Karma plugin for Intellij Platform IDE
> Install plugin from ??File -> Settings -> IDE Settings -> Plugins??.
> After IDE restart go to ??Run -> Edit Configuration??. 
> Add configuration: press *plus* button, select *Karma*. Now fill inputs with path to:
*Node.js interpreter*, *Karma node package* and *Configuration file* it should be *project_root/ambari-web/karma.conf.js*.
> After setup you can run karma from *Debug panel* [picture-1|]
and you will see progress in *4: Run* tab [picture-2|].
You can set *Auto-test* by pressing ??Toggle auto-test?? button.

This message was sent by Atlassian JIRA

View raw message