karma-jasmine
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -184,3 +184,3 @@ (function(window) { | ||
jasmineEnv.addReporter(new KarmaReporter(tc, jasmineEnv)); | ||
jasmineEnv.executeFiltered(); | ||
jasmineEnv.execute(); | ||
}; | ||
@@ -187,0 +187,0 @@ }; |
142
lib/boot.js
@@ -6,4 +6,7 @@ /** | ||
*/ | ||
(function(){ | ||
(function (global) { | ||
/*global jasmineRequire */ | ||
'use strict'; | ||
/** | ||
@@ -13,99 +16,19 @@ * Require Jasmine's core files. Specifically, this requires and | ||
*/ | ||
window.jasmine = jasmineRequire.core(jasmineRequire); | ||
var jasmine = jasmineRequire.core(jasmineRequire); | ||
/** | ||
* Create the Jasmine environment. This is used to run all specs | ||
* in a project. | ||
* Obtain the public Jasmine API. | ||
*/ | ||
var env = jasmine.getEnv(); | ||
var jasmineInterface = jasmineRequire.interface(jasmine, jasmine.getEnv()); | ||
var focusedSuites = []; | ||
var focusedSpecs = []; | ||
var insideFocusedSuite = false; | ||
var focuseSpec = function(env, description, body) { | ||
var spec = env.it(description, body); | ||
focusedSpecs.push(spec.id); | ||
return spec; | ||
}; | ||
var focuseSuite = function(env, description, body) { | ||
if (insideFocusedSuite) { | ||
return env.describe(description, body); | ||
} | ||
insideFocusedSuite = true; | ||
var suite = env.describe(description, body); | ||
insideFocusedSuite = false | ||
focusedSuites.push(suite.id); | ||
return suite; | ||
}; | ||
/** | ||
* Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require | ||
* this hack. | ||
* Setting up timing functions to be able to be overridden. | ||
* Certain browsers (Safari, IE 8, PhantomJS) require this hack. | ||
*/ | ||
window.setTimeout = window.setTimeout; | ||
window.setInterval = window.setInterval; | ||
window.clearTimeout = window.clearTimeout; | ||
window.clearInterval = window.clearInterval; | ||
global.setTimeout = global.setTimeout; | ||
global.setInterval = global.setInterval; | ||
global.clearTimeout = global.clearTimeout; | ||
global.clearInterval = global.clearInterval; | ||
/** | ||
* Build up the functions that will be exposed as the Jasmine | ||
* public interface. | ||
*/ | ||
var jasmineInterface = { | ||
describe: function(description, specDefinitions) { | ||
return env.describe(description, specDefinitions); | ||
}, | ||
xdescribe: function(description, specDefinitions) { | ||
return env.xdescribe(description, specDefinitions); | ||
}, | ||
ddescribe: function(description, specDefinitions) { | ||
return focuseSuite(env, description, specDefinitions); | ||
}, | ||
it: function(desc, func) { | ||
return env.it(desc, func); | ||
}, | ||
xit: function(desc, func) { | ||
return env.xit(desc, func); | ||
}, | ||
iit: function(desc, func) { | ||
return focuseSpec(env, desc, func); | ||
}, | ||
beforeEach: function(beforeEachFunction) { | ||
return env.beforeEach(beforeEachFunction); | ||
}, | ||
afterEach: function(afterEachFunction) { | ||
return env.afterEach(afterEachFunction); | ||
}, | ||
expect: function(actual) { | ||
return env.expect(actual); | ||
}, | ||
pending: function() { | ||
return env.pending(); | ||
}, | ||
spyOn: function(obj, methodName) { | ||
return env.spyOn(obj, methodName); | ||
}, | ||
jsApiReporter: new jasmine.JsApiReporter({ | ||
timer: new jasmine.Timer() | ||
}) | ||
}; | ||
/** | ||
* Add all of the Jasmine global/public interface to the proper | ||
@@ -118,41 +41,6 @@ * global, so a project can use the public interface directly. | ||
if (jasmineInterface.hasOwnProperty(property)) { | ||
window[property] = jasmineInterface[property]; | ||
global[property] = jasmineInterface[property]; | ||
} | ||
} | ||
env.executeFiltered = function() { | ||
if (focusedSpecs.length) { | ||
env.execute(focusedSpecs); | ||
} else if (focusedSuites.length) { | ||
env.execute(focusedSuites); | ||
} else { | ||
env.execute(); | ||
} | ||
}; | ||
/** | ||
* Expose the interface for adding custom equality testers. | ||
*/ | ||
jasmine.addCustomEqualityTester = function(tester) { | ||
env.addCustomEqualityTester(tester); | ||
}; | ||
/** | ||
* Expose the interface for adding custom expectation matchers | ||
*/ | ||
jasmine.addMatchers = function(matchers) { | ||
return env.addMatchers(matchers); | ||
}; | ||
/** | ||
* Expose the mock interface for the JavaScript timeout functions | ||
*/ | ||
jasmine.clock = function() { | ||
return env.clock; | ||
}; | ||
})(); | ||
}(window)); |
{ | ||
"name": "karma-jasmine", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "A Karma plugin - adapter for Jasmine testing framework.", | ||
@@ -31,3 +31,3 @@ "main": "lib/index.js", | ||
"grunt-bump": "~0.0.7", | ||
"jasmine-core": "~2.0.0" | ||
"jasmine-core": "~2.1.0" | ||
}, | ||
@@ -43,2 +43,4 @@ "peerDependencies": { | ||
"Friedel Ziegelmayer <friedel.ziegelmayer@gmail.com>", | ||
"olegskl <sklyanchuk@gmail.com>", | ||
"Alesei N <github.com@bzik.net>", | ||
"Barry Fitzgerald <barfitzgerald@gmail.com>", | ||
@@ -45,0 +47,0 @@ "Marek Vavrecan <vavrecan@gmail.com>", |
# karma-jasmine [![Build Status](https://travis-ci.org/karma-runner/karma-jasmine.svg?branch=master)](https://travis-ci.org/karma-runner/karma-jasmine) | ||
> Adapter for the [Jasmine](http://pivotal.github.io/jasmine/) testing framework. | ||
> Adapter for the [Jasmine](http://jasmine.github.io/) testing framework. | ||
@@ -5,0 +5,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10399
196