Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First version. Copied from karma-growl-reporter, growly replaced with…
… growl
- Loading branch information
Showing
8 changed files
with
136 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ lib-cov | |
*.out | ||
*.pid | ||
*.gz | ||
|
||
node_modules | ||
pids | ||
logs | ||
results | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,46 @@ | ||
karma-growler-reporter | ||
====================== | ||
|
||
> Report test results using [growl](https://github.com/visionmedia/node-growl) (copied from [karma-growl-reporter](https://github.com/karma-runner/karma-growl-reporter), growly replaced with growl). | ||
## Installation | ||
This plugin uses [growl](https://github.com/visionmedia/node-growl), which uses [terminal-notifier](https://github.com/alloy/terminal-notifier) for Mac OS X, [libnotify-bin](http://packages.ubuntu.com/search?keywords=libnotify-bin) for Linux and [growlnotify](http://www.growlforwindows.com/gfw/help/growlnotify.aspx) for Windows. | ||
|
||
The easiest way is to keep `karma-growler-reporter` as a devDependency in your `package.json`. | ||
|
||
```json | ||
{ | ||
"devDependencies": { | ||
"karma": "~0.10", | ||
"karma-growl-reporter": "~0.1" | ||
} | ||
} | ||
``` | ||
|
||
You can simple do it by: | ||
```bash | ||
npm install karma-growler-reporter --save-dev | ||
``` | ||
|
||
|
||
### | ||
|
||
## Configuration | ||
```js | ||
// karma.conf.js | ||
module.exports = function(config) { | ||
config.set({ | ||
reporters: ['progress', 'growler'], | ||
}); | ||
}; | ||
``` | ||
|
||
You can pass list of reporters as a CLI argument too: | ||
```bash | ||
karma start --reporters growler ,dots | ||
``` | ||
|
||
For more information on Karma see the [homepage]. | ||
|
||
[homepage]: http://karma-runner.github.com | ||
|
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
var util = require('util'); | ||
var growl = require('growl'); | ||
var path = require('path'); | ||
|
||
var MSG_SUCCESS = '%d tests passed in %s.'; | ||
var MSG_FAILURE = '%d/%d tests failed in %s.'; | ||
var MSG_ERROR = ''; | ||
|
||
var OPTIONS = { | ||
success: { | ||
name: 'Success', | ||
title: 'PASSED - %s', | ||
icon: path.join(__dirname, 'images/success.png') | ||
}, | ||
failed: { | ||
name: 'Failure', | ||
title: 'FAILED - %s', | ||
icon: path.join(__dirname, 'images/failed.png') | ||
}, | ||
error: { | ||
name: 'Aborted', | ||
title: 'ERROR - %s', | ||
icon: path.join(__dirname, 'images/error.png') | ||
} | ||
}; | ||
|
||
var GrowlReporter = function(helper, logger, config) { | ||
var log = logger.create('reporter.growler'); | ||
|
||
var optionsFor = function(type, browser) { | ||
var prefix = config && config.prefix ? config.prefix : ''; | ||
return helper.merge( | ||
OPTIONS[type], | ||
{title: prefix + util.format(OPTIONS[type].title, browser)} | ||
); | ||
}; | ||
|
||
this.adapters = []; | ||
this.onBrowserComplete = function(browser) { | ||
var results = browser.lastResult; | ||
var time = helper.formatTimeInterval(results.totalTime); | ||
|
||
if (results.disconnected || results.error) { | ||
return growl(MSG_ERROR, optionsFor('error', browser.name)); | ||
} | ||
|
||
if (results.failed) { | ||
return growl( | ||
util.format(MSG_FAILURE, results.failed, results.total, time), | ||
optionsFor('failed', browser.name) | ||
); | ||
} | ||
|
||
growl( | ||
util.format(MSG_SUCCESS, results.success, time), | ||
optionsFor('success', browser.name) | ||
); | ||
}; | ||
}; | ||
|
||
GrowlReporter.$inject = ['helper', 'logger','config.growlerReporter']; | ||
|
||
// PUBLISH DI MODULE | ||
module.exports = { | ||
'reporter:growler': ['type', GrowlReporter] | ||
}; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "karma-growler-reporter", | ||
"version": "0.0.1", | ||
"description": "A Karma plugin. Report results with growl (https://npmjs.org/package/growl).", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/gm0t/karma-growler-reporter.git" | ||
}, | ||
"keywords": [ | ||
"growl", | ||
"karma" | ||
], | ||
"author": "Bogdanov Mikhail <admin@gm0t.ru>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/gm0t/karma-growler-reporter/issues" | ||
}, | ||
"dependencies": { | ||
"growl": "~1.7.0" | ||
} | ||
} |