Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6816bc4252 | ||
|
|
04bb56a5b5 | ||
|
|
ed31b9b844 | ||
|
|
4e47b78f1f | ||
|
|
8624a52ee0 |
17
.github/ISSUE_TEMPLATE.md
vendored
Normal file
17
.github/ISSUE_TEMPLATE.md
vendored
Normal 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!
|
||||||
@@ -67,7 +67,7 @@ var getJasmineRequireObj = (function (jasmineGlobal) {
|
|||||||
j$.ReportDispatcher = jRequire.ReportDispatcher();
|
j$.ReportDispatcher = jRequire.ReportDispatcher();
|
||||||
j$.Spec = jRequire.Spec(j$);
|
j$.Spec = jRequire.Spec(j$);
|
||||||
j$.SpyRegistry = jRequire.SpyRegistry(j$);
|
j$.SpyRegistry = jRequire.SpyRegistry(j$);
|
||||||
j$.SpyStrategy = jRequire.SpyStrategy();
|
j$.SpyStrategy = jRequire.SpyStrategy(j$);
|
||||||
j$.StringMatching = jRequire.StringMatching(j$);
|
j$.StringMatching = jRequire.StringMatching(j$);
|
||||||
j$.Suite = jRequire.Suite(j$);
|
j$.Suite = jRequire.Suite(j$);
|
||||||
j$.Timer = jRequire.Timer();
|
j$.Timer = jRequire.Timer();
|
||||||
@@ -147,6 +147,10 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
return j$.isA_('Number', value);
|
return j$.isA_('Number', value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
j$.isFunction_ = function(value) {
|
||||||
|
return j$.isA_('Function', value);
|
||||||
|
};
|
||||||
|
|
||||||
j$.isA_ = function(typeName, value) {
|
j$.isA_ = function(typeName, value) {
|
||||||
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
|
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
|
||||||
};
|
};
|
||||||
@@ -788,6 +792,10 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
reporter.provideFallbackReporter(reporterToAdd);
|
reporter.provideFallbackReporter(reporterToAdd);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.clearReporters = function() {
|
||||||
|
reporter.clearReporters();
|
||||||
|
};
|
||||||
|
|
||||||
var spyRegistry = new j$.SpyRegistry({currentSpies: function() {
|
var spyRegistry = new j$.SpyRegistry({currentSpies: function() {
|
||||||
if(!currentRunnable()) {
|
if(!currentRunnable()) {
|
||||||
throw new Error('Spies must be created in a before function or a spec');
|
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) {
|
this.addReporter = function(reporter) {
|
||||||
reporters.push(reporter);
|
reporters.push(reporter);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.provideFallbackReporter = function(reporter) {
|
this.provideFallbackReporter = function(reporter) {
|
||||||
fallbackReporter = reporter;
|
fallbackReporter = reporter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.clearReporters = function() {
|
||||||
|
reporters = [];
|
||||||
|
};
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
@@ -2120,7 +2131,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
|||||||
return SpyRegistry;
|
return SpyRegistry;
|
||||||
};
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().SpyStrategy = function() {
|
getJasmineRequireObj().SpyStrategy = function(j$) {
|
||||||
|
|
||||||
function SpyStrategy(options) {
|
function SpyStrategy(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
@@ -2167,7 +2178,7 @@ getJasmineRequireObj().SpyStrategy = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.callFake = function(fn) {
|
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);
|
throw new Error('Argument passed to callFake should be a function, got ' + fn);
|
||||||
}
|
}
|
||||||
plan = fn;
|
plan = fn;
|
||||||
@@ -3640,5 +3651,5 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().version = function() {
|
getJasmineRequireObj().version = function() {
|
||||||
return '2.5.1';
|
return '2.5.2';
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,6 @@
|
|||||||
#
|
#
|
||||||
module Jasmine
|
module Jasmine
|
||||||
module Core
|
module Core
|
||||||
VERSION = "2.5.1"
|
VERSION = "2.5.2"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jasmine-core",
|
"name": "jasmine-core",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "2.5.1",
|
"version": "2.5.2",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/jasmine/jasmine.git"
|
"url": "https://github.com/jasmine/jasmine.git"
|
||||||
|
|||||||
14
release_notes/2.5.2.md
Normal file
14
release_notes/2.5.2.md
Normal 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)_
|
||||||
@@ -45,7 +45,6 @@ describe("ReportDispatcher", function() {
|
|||||||
dispatcher.provideFallbackReporter(reporter);
|
dispatcher.provideFallbackReporter(reporter);
|
||||||
dispatcher.foo(123, 456);
|
dispatcher.foo(123, 456);
|
||||||
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
|
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not call fallback reporting methods when another report is provided", function() {
|
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(reporter.foo).toHaveBeenCalledWith(123, 456);
|
||||||
expect(fallbackReporter.foo).not.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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -94,14 +94,14 @@ describe("SpyStrategy", function() {
|
|||||||
|
|
||||||
it('throws an error when a non-function is passed to callFake strategy', function() {
|
it('throws an error when a non-function is passed to callFake strategy', function() {
|
||||||
var originalFn = jasmine.createSpy('original'),
|
var originalFn = jasmine.createSpy('original'),
|
||||||
|
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
|
||||||
invalidFakes = [5, 'foo', {}, true, false, null, void 0, new Date(), /.*/];
|
invalidFakes = [5, 'foo', {}, true, false, null, void 0, new Date(), /.*/];
|
||||||
|
|
||||||
for (var i=0; i<invalidFakes.length; i++) {
|
spyOn(jasmineUnderTest, 'isFunction_').and.returnValue(false);
|
||||||
var invalidFake = invalidFakes[i],
|
|
||||||
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn});
|
|
||||||
|
|
||||||
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() {
|
it("allows a return to plan stubbing after another strategy", function() {
|
||||||
|
|||||||
@@ -23,4 +23,5 @@ spec_files:
|
|||||||
- '!npmPackage/**/*'
|
- '!npmPackage/**/*'
|
||||||
spec_dir: spec
|
spec_dir: spec
|
||||||
random: true
|
random: true
|
||||||
|
spec_helper: spec/support/jasmine_helper.rb
|
||||||
|
|
||||||
|
|||||||
3
spec/support/jasmine_helper.rb
Normal file
3
spec/support/jasmine_helper.rb
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Jasmine.configure do |config|
|
||||||
|
config.prevent_phantom_js_auto_install = true
|
||||||
|
end
|
||||||
@@ -278,6 +278,10 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
reporter.provideFallbackReporter(reporterToAdd);
|
reporter.provideFallbackReporter(reporterToAdd);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.clearReporters = function() {
|
||||||
|
reporter.clearReporters();
|
||||||
|
};
|
||||||
|
|
||||||
var spyRegistry = new j$.SpyRegistry({currentSpies: function() {
|
var spyRegistry = new j$.SpyRegistry({currentSpies: function() {
|
||||||
if(!currentRunnable()) {
|
if(!currentRunnable()) {
|
||||||
throw new Error('Spies must be created in a before function or a spec');
|
throw new Error('Spies must be created in a before function or a spec');
|
||||||
|
|||||||
@@ -18,11 +18,14 @@ getJasmineRequireObj().ReportDispatcher = function() {
|
|||||||
this.addReporter = function(reporter) {
|
this.addReporter = function(reporter) {
|
||||||
reporters.push(reporter);
|
reporters.push(reporter);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.provideFallbackReporter = function(reporter) {
|
this.provideFallbackReporter = function(reporter) {
|
||||||
fallbackReporter = reporter;
|
fallbackReporter = reporter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.clearReporters = function() {
|
||||||
|
reporters = [];
|
||||||
|
};
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
getJasmineRequireObj().SpyStrategy = function() {
|
getJasmineRequireObj().SpyStrategy = function(j$) {
|
||||||
|
|
||||||
function SpyStrategy(options) {
|
function SpyStrategy(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
@@ -45,7 +45,7 @@ getJasmineRequireObj().SpyStrategy = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.callFake = function(fn) {
|
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);
|
throw new Error('Argument passed to callFake should be a function, got ' + fn);
|
||||||
}
|
}
|
||||||
plan = fn;
|
plan = fn;
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
return j$.isA_('Number', value);
|
return j$.isA_('Number', value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
j$.isFunction_ = function(value) {
|
||||||
|
return j$.isA_('Function', value);
|
||||||
|
};
|
||||||
|
|
||||||
j$.isA_ = function(typeName, value) {
|
j$.isA_ = function(typeName, value) {
|
||||||
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
|
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ var getJasmineRequireObj = (function (jasmineGlobal) {
|
|||||||
j$.ReportDispatcher = jRequire.ReportDispatcher();
|
j$.ReportDispatcher = jRequire.ReportDispatcher();
|
||||||
j$.Spec = jRequire.Spec(j$);
|
j$.Spec = jRequire.Spec(j$);
|
||||||
j$.SpyRegistry = jRequire.SpyRegistry(j$);
|
j$.SpyRegistry = jRequire.SpyRegistry(j$);
|
||||||
j$.SpyStrategy = jRequire.SpyStrategy();
|
j$.SpyStrategy = jRequire.SpyStrategy(j$);
|
||||||
j$.StringMatching = jRequire.StringMatching(j$);
|
j$.StringMatching = jRequire.StringMatching(j$);
|
||||||
j$.Suite = jRequire.Suite(j$);
|
j$.Suite = jRequire.Suite(j$);
|
||||||
j$.Timer = jRequire.Timer();
|
j$.Timer = jRequire.Timer();
|
||||||
|
|||||||
Reference in New Issue
Block a user