Compare commits

...

5 Commits

Author SHA1 Message Date
Gregg Van Hove
6816bc4252 Update to 2.5.2 2016-09-16 17:19:59 -07:00
Gregg Van Hove
04bb56a5b5 Allow currently registered reporters to be cleared
- jasmine/jasmine-npm#88
2016-09-16 16:02:08 -07:00
Greg Cobb
ed31b9b844 Add ISSUE_TEMPLATE for github issues 2016-09-16 10:26:11 -07:00
Gregg Van Hove
4e47b78f1f Use isFunction to check for functionness in callFake
- Fixes #1191
2016-09-14 16:06:44 -07:00
Gregg Van Hove
8624a52ee0 Don't auto install phantom since it doesn't seem to work on travis 2016-09-07 15:48:20 -07:00
15 changed files with 89 additions and 17 deletions

17
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,17 @@
### Are you creating an issue in the correct repository?
- When in doubt, create an issue here.
- If you have an issue with the Jasmine docs, file an issue in the docs repo
here: https://github.com/jasmine/jasmine.github.io
- This repository is for the core Jasmine framework
- If you are using a test runner that wraps Jasmine (Jasmine npm, karma, etc),
consider filing an issue with that library if appropriate
### When submitting an issue, please answer the following:
- What version are you using?
- What environment are you running Jasmine in (node, browser, etc)?
- How are you running Jasmine (standalone, npm, karma, etc)?
- If possible, include an example spec that demonstrates your issue.
Thanks for using Jasmine!

View File

@@ -67,7 +67,7 @@ var getJasmineRequireObj = (function (jasmineGlobal) {
j$.ReportDispatcher = jRequire.ReportDispatcher();
j$.Spec = jRequire.Spec(j$);
j$.SpyRegistry = jRequire.SpyRegistry(j$);
j$.SpyStrategy = jRequire.SpyStrategy();
j$.SpyStrategy = jRequire.SpyStrategy(j$);
j$.StringMatching = jRequire.StringMatching(j$);
j$.Suite = jRequire.Suite(j$);
j$.Timer = jRequire.Timer();
@@ -147,6 +147,10 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
return j$.isA_('Number', value);
};
j$.isFunction_ = function(value) {
return j$.isA_('Function', value);
};
j$.isA_ = function(typeName, value) {
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
};
@@ -788,6 +792,10 @@ getJasmineRequireObj().Env = function(j$) {
reporter.provideFallbackReporter(reporterToAdd);
};
this.clearReporters = function() {
reporter.clearReporters();
};
var spyRegistry = new j$.SpyRegistry({currentSpies: function() {
if(!currentRunnable()) {
throw new Error('Spies must be created in a before function or a spec');
@@ -2013,11 +2021,14 @@ getJasmineRequireObj().ReportDispatcher = function() {
this.addReporter = function(reporter) {
reporters.push(reporter);
};
this.provideFallbackReporter = function(reporter) {
fallbackReporter = reporter;
};
this.clearReporters = function() {
reporters = [];
};
return this;
@@ -2120,7 +2131,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
return SpyRegistry;
};
getJasmineRequireObj().SpyStrategy = function() {
getJasmineRequireObj().SpyStrategy = function(j$) {
function SpyStrategy(options) {
options = options || {};
@@ -2167,7 +2178,7 @@ getJasmineRequireObj().SpyStrategy = function() {
};
this.callFake = function(fn) {
if(!(fn instanceof Function)) {
if(!j$.isFunction_(fn)) {
throw new Error('Argument passed to callFake should be a function, got ' + fn);
}
plan = fn;
@@ -3640,5 +3651,5 @@ getJasmineRequireObj().interface = function(jasmine, env) {
};
getJasmineRequireObj().version = function() {
return '2.5.1';
return '2.5.2';
};

View File

@@ -4,6 +4,6 @@
#
module Jasmine
module Core
VERSION = "2.5.1"
VERSION = "2.5.2"
end
end

View File

@@ -1,7 +1,7 @@
{
"name": "jasmine-core",
"license": "MIT",
"version": "2.5.1",
"version": "2.5.2",
"repository": {
"type": "git",
"url": "https://github.com/jasmine/jasmine.git"

14
release_notes/2.5.2.md Normal file
View File

@@ -0,0 +1,14 @@
# Jasmine 2.5.2 Release Notes
## Pull Requests & Issues
* Allow currently registered reporters to be cleared
- [jasmine/jasmine-npm#88](https://github.com/jasmine/jasmine-npm/issues/88)
* Use `isFunction` to check for functionness in `callFake`
- Fixes [#1191](https://github.com/jasmine/jasmine/issues/1191)
------
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_

View File

@@ -45,7 +45,6 @@ describe("ReportDispatcher", function() {
dispatcher.provideFallbackReporter(reporter);
dispatcher.foo(123, 456);
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
});
it("does not call fallback reporting methods when another report is provided", function() {
@@ -59,6 +58,22 @@ describe("ReportDispatcher", function() {
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
expect(fallbackReporter.foo).not.toHaveBeenCalledWith(123, 456);
});
it("allows registered reporters to be cleared", function() {
var dispatcher = new jasmineUnderTest.ReportDispatcher(['foo', 'bar']),
reporter1 = jasmine.createSpyObj('reporter1', ['foo', 'bar']),
reporter2 = jasmine.createSpyObj('reporter2', ['foo', 'bar']);
dispatcher.addReporter(reporter1);
dispatcher.foo(123);
expect(reporter1.foo).toHaveBeenCalledWith(123);
dispatcher.clearReporters();
dispatcher.addReporter(reporter2);
dispatcher.bar(456);
expect(reporter1.bar).not.toHaveBeenCalled();
expect(reporter2.bar).toHaveBeenCalledWith(456);
});
});

View File

@@ -94,14 +94,14 @@ describe("SpyStrategy", function() {
it('throws an error when a non-function is passed to callFake strategy', function() {
var originalFn = jasmine.createSpy('original'),
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
invalidFakes = [5, 'foo', {}, true, false, null, void 0, new Date(), /.*/];
for (var i=0; i<invalidFakes.length; i++) {
var invalidFake = invalidFakes[i],
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn});
spyOn(jasmineUnderTest, 'isFunction_').and.returnValue(false);
expect(function() {spyStrategy.callFake(invalidFake);}).toThrowError('Argument passed to callFake should be a function, got ' + invalidFake);
}
expect(function () {
spyStrategy.callFake(function() {});
}).toThrowError(/^Argument passed to callFake should be a function, got/);
});
it("allows a return to plan stubbing after another strategy", function() {

View File

@@ -23,4 +23,5 @@ spec_files:
- '!npmPackage/**/*'
spec_dir: spec
random: true
spec_helper: spec/support/jasmine_helper.rb

View File

@@ -0,0 +1,3 @@
Jasmine.configure do |config|
config.prevent_phantom_js_auto_install = true
end

View File

@@ -278,6 +278,10 @@ getJasmineRequireObj().Env = function(j$) {
reporter.provideFallbackReporter(reporterToAdd);
};
this.clearReporters = function() {
reporter.clearReporters();
};
var spyRegistry = new j$.SpyRegistry({currentSpies: function() {
if(!currentRunnable()) {
throw new Error('Spies must be created in a before function or a spec');

View File

@@ -18,11 +18,14 @@ getJasmineRequireObj().ReportDispatcher = function() {
this.addReporter = function(reporter) {
reporters.push(reporter);
};
this.provideFallbackReporter = function(reporter) {
fallbackReporter = reporter;
};
this.clearReporters = function() {
reporters = [];
};
return this;

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().SpyStrategy = function() {
getJasmineRequireObj().SpyStrategy = function(j$) {
function SpyStrategy(options) {
options = options || {};
@@ -45,7 +45,7 @@ getJasmineRequireObj().SpyStrategy = function() {
};
this.callFake = function(fn) {
if(!(fn instanceof Function)) {
if(!j$.isFunction_(fn)) {
throw new Error('Argument passed to callFake should be a function, got ' + fn);
}
plan = fn;

View File

@@ -29,6 +29,10 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
return j$.isA_('Number', value);
};
j$.isFunction_ = function(value) {
return j$.isA_('Function', value);
};
j$.isA_ = function(typeName, value) {
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
};

View File

@@ -45,7 +45,7 @@ var getJasmineRequireObj = (function (jasmineGlobal) {
j$.ReportDispatcher = jRequire.ReportDispatcher();
j$.Spec = jRequire.Spec(j$);
j$.SpyRegistry = jRequire.SpyRegistry(j$);
j$.SpyStrategy = jRequire.SpyStrategy();
j$.SpyStrategy = jRequire.SpyStrategy(j$);
j$.StringMatching = jRequire.StringMatching(j$);
j$.Suite = jRequire.Suite(j$);
j$.Timer = jRequire.Timer();