Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jasmine-growl-reporter

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jasmine-growl-reporter - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

res/failed.png

25

lib/reporter.js

@@ -5,3 +5,4 @@

deps = deps || {};
var growl = deps.growl || require('growl');
var growl = deps.growl || require('growl'),
path = require('path');

@@ -41,3 +42,4 @@ var GrowlReporter = function() {

name: growlName,
title: growlTitle(this.counts, this.startedAt)
title: growlTitle(this.counts, this.startedAt),
image: growlImage(this.counts)
});

@@ -47,7 +49,8 @@ }

var growlName = 'Jasmine';
var growlName = 'Jasmine',
resDir = path.resolve(__dirname, '../res');
var growlTitle = function(counts, startedAt) {
var title = counts.failed ? 'FAILED' : 'PASSED';
var title = passed(counts) ? 'PASSED' : 'FAILED';
title += ' in ' + ((new Date().getTime() - startedAt.getTime()) / 1000) + 's';

@@ -73,3 +76,15 @@

var growlImage = function(counts) {
if (passed(counts)) {
return path.join(resDir, 'passed.png');
} else {
return path.join(resDir, 'failed.png');
}
};
var passed = function(counts) {
return !counts.failed;
};
return GrowlReporter;
};

7

package.json
{
"name": "jasmine-growl-reporter",
"version": "0.2.0",
"version": "0.2.1",
"main": "./index.js",
"scripts": {
"test": "jasmine-node spec"
"test": "grunt"
},

@@ -12,3 +12,3 @@ "dependencies": {

"devDependencies": {
"grunt": "~0.4.2",
"grunt": "~0.4.3",
"grunt-bump": "~0.0.13",

@@ -18,3 +18,2 @@ "grunt-contrib-jshint": "~0.8.0",

"grunt-contrib-watch": "~0.5.3",
"jasmine-node": "~1.13.1",
"underscore": "~1.6.0"

@@ -21,0 +20,0 @@ },

@@ -9,9 +9,29 @@ # Jasmine Growl Reporter

![jasmine-growl-reporter](https://raw.github.com/AlphaHydrae/jasmine-growl-reporter/master/res/screenshot.png)
![jasmine-growl-reporter passed tests](https://raw.github.com/AlphaHydrae/jasmine-growl-reporter/master/res/screenshot-passed.png)
![jasmine-growl-reporter failed tests](https://raw.github.com/AlphaHydrae/jasmine-growl-reporter/master/res/screenshot-failed.png)
See [node-growl](https://github.com/visionmedia/node-growl) for platform-specific support.
This reporter is included with [jasmine-node](https://github.com/mhevery/jasmine-node) and [grunt-jasmine-node](https://github.com/jasmine-contrib/grunt-jasmine-node).
See [node-growl](https://github.com/visionmedia/node-growl) for platform-specific installation instructions.
## Compatibility
* `v0.2.*` and higher are compatible with Jasmine 2.0 reporters
* `v0.0.*` are compatible with Jasmine 1.3 reporters
## OS X Notification Center
Due to how the OS X Notification Center and [terminal-notifier](https://github.com/alloy/terminal-notifier) work,
passed and failed icons cannot currently be shown when forwarding Growl notifications to the notification center:
![jasmine-growl-reporter notification center](https://raw.github.com/AlphaHydrae/jasmine-growl-reporter/master/res/screenshot-notification-center.png)
## Meta
* **Author:** Simon Oulevay (Alpha Hydrae)
* **Author:** [Simon Oulevay (Alpha Hydrae)](https://github.com/AlphaHydrae)
* **License:** MIT (see [LICENSE.txt](https://raw.github.com/AlphaHydrae/jasmine-growl-reporter/master/LICENSE.txt))
* **Icons:** [Free Must Have Icons from VisualPharm](http://www.visualpharm.com/must_have_icon_set/)
### Contributors
* [Michael Kebe](https://github.com/michaelkebe) (show passed and failed icons)
var _ = require('underscore');
var _ = require('underscore'),
path = require('path'),
RunnerMock = require('./runnerMock'),
growlReporterInjector = require('../lib/reporter').inject;
require('./matchers');

@@ -7,33 +11,24 @@

var injector = require('../lib/reporter').inject,
growl = null,
reporter = null;
var expectedTitle = 'Jasmine',
passedRegexp = /^PASSED in [\d\.]+s$/,
failedRegexp = /^FAILED in [\d\.]+s$/,
passedImage = path.resolve(__dirname, '../res/passed.png'),
failedImage = path.resolve(__dirname, '../res/failed.png');
var fakeSpecResult = function(passed) {
return {
status: passed ? 'passed' : 'failed'
};
};
var growl, reporter, runner;
var pendingSpecResult = function() {
return {
status: 'pending'
};
};
var title = 'Jasmine',
passedRegexp = /^PASSED in [\d\.]+s$/,
failedRegexp = /^FAILED in [\d\.]+s$/;
beforeEach(function() {
growl = jasmine.createSpy();
reporter = new (injector({ growl: growl }))();
reporter = new (growlReporterInjector({ growl: growl }))();
runner = new RunnerMock(reporter);
});
it("should report 0 results", function() {
reporter.jasmineStarted();
reporter.jasmineDone();
runner.suite(function() {});
expect(growl).toHaveNotified('0 tests', {
name: title,
title: passedRegexp
name: expectedTitle,
title: passedRegexp,
image: passedImage
});

@@ -43,11 +38,11 @@ });

it("should report 2 successful results", function() {
reporter.jasmineStarted();
_.times(2, function() {
reporter.specStarted();
reporter.specDone(fakeSpecResult(true));
runner.suite(function() {
_.times(2, this.passTest, this);
});
reporter.jasmineDone();
expect(growl).toHaveNotified('2 tests, 0 failed', {
name: title,
title: passedRegexp
name: expectedTitle,
title: passedRegexp,
image: passedImage
});

@@ -57,11 +52,11 @@ });

it("should report 3 failed results", function() {
reporter.jasmineStarted();
_.times(3, function() {
reporter.specStarted();
reporter.specDone(fakeSpecResult(false));
runner.suite(function() {
_.times(3, this.failTest, this);
});
reporter.jasmineDone();
expect(growl).toHaveNotified('3 tests, 3 failed', {
name: title,
title: failedRegexp
name: expectedTitle,
title: failedRegexp,
image: failedImage
});

@@ -71,15 +66,12 @@ });

it("should report 2 passed and 4 failed results", function() {
reporter.jasmineStarted();
_.times(2, function() {
reporter.specStarted();
reporter.specDone(fakeSpecResult(true));
runner.suite(function() {
_.times(2, this.passTest, this);
_.times(4, this.failTest, this);
});
_.times(4, function() {
reporter.specStarted();
reporter.specDone(fakeSpecResult(false));
});
reporter.jasmineDone();
expect(growl).toHaveNotified('6 tests, 4 failed', {
name: title,
title: failedRegexp
name: expectedTitle,
title: failedRegexp,
image: failedImage
});

@@ -89,11 +81,11 @@ });

it("should report 3 pending results", function() {
reporter.jasmineStarted();
_.times(3, function() {
reporter.specStarted();
reporter.specDone(pendingSpecResult());
runner.suite(function() {
_.times(3, this.skipTest, this);
});
reporter.jasmineDone();
expect(growl).toHaveNotified('3 tests, 0 failed, 3 pending', {
name: title,
title: passedRegexp
name: expectedTitle,
title: passedRegexp,
image: passedImage
});

@@ -103,15 +95,12 @@ });

it("should report 1 passed and 2 pending results", function() {
reporter.jasmineStarted();
_.times(1, function() {
reporter.specStarted();
reporter.specDone(fakeSpecResult(true));
runner.suite(function() {
_.times(1, this.passTest, this);
_.times(2, this.skipTest, this);
});
_.times(2, function() {
reporter.specStarted();
reporter.specDone(pendingSpecResult());
});
reporter.jasmineDone();
expect(growl).toHaveNotified('3 tests, 0 failed, 2 pending', {
name: title,
title: passedRegexp
name: expectedTitle,
title: passedRegexp,
image: passedImage
});

@@ -121,15 +110,12 @@ });

it("should report 4 pending and 5 failed results", function() {
reporter.jasmineStarted();
_.times(4, function() {
reporter.specStarted();
reporter.specDone(pendingSpecResult());
runner.suite(function() {
_.times(4, this.skipTest, this);
_.times(5, this.failTest, this);
});
_.times(5, function() {
reporter.specStarted();
reporter.specDone(fakeSpecResult(false));
});
reporter.jasmineDone();
expect(growl).toHaveNotified('9 tests, 5 failed, 4 pending', {
name: title,
title: failedRegexp
name: expectedTitle,
title: failedRegexp,
image: failedImage
});

@@ -139,21 +125,15 @@ });

it("should report 2 passed, 3 pending and 4 failed results", function() {
reporter.jasmineStarted();
_.times(2, function() {
reporter.specStarted();
reporter.specDone(fakeSpecResult(true));
runner.suite(function() {
_.times(2, this.passTest, this);
_.times(3, this.skipTest, this);
_.times(4, this.failTest, this);
});
_.times(3, function() {
reporter.specStarted();
reporter.specDone(pendingSpecResult());
});
_.times(4, function() {
reporter.specStarted();
reporter.specDone(fakeSpecResult(false));
});
reporter.jasmineDone();
expect(growl).toHaveNotified('9 tests, 4 failed, 3 pending', {
name: title,
title: failedRegexp
name: expectedTitle,
title: failedRegexp,
image: failedImage
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc