Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2835ca3cce | ||
|
|
120c484419 | ||
|
|
1d62504534 | ||
|
|
055d88eff8 | ||
|
|
d2b33e0c66 | ||
|
|
0c7f36a181 | ||
|
|
686d8157e5 | ||
|
|
b771c083cb | ||
|
|
fbd2ffc08b | ||
|
|
b3c8fb9797 | ||
|
|
ef3cfe7f44 | ||
|
|
0d6ecbec17 | ||
|
|
7e4b8d4531 |
16
README.md
16
README.md
@@ -32,23 +32,23 @@ For the Jasmine Python Egg:<br>
|
||||
For the Jasmine headless browser gulp plugin:<br>
|
||||
[https://github.com/jasmine/gulp-jasmine-browser](https://github.com/jasmine/gulp-jasmine-browser)
|
||||
|
||||
To install Jasmine standalone on your local box:
|
||||
To install Jasmine standalone on your local box (where **_{#.#.#}_** below is substituted by the release number downloaded):
|
||||
|
||||
* Download the standalone distribution for your desired release from the [releases page](https://github.com/jasmine/jasmine/releases)
|
||||
* Create a Jasmine directory in your project - `mkdir my-project/jasmine`
|
||||
* Move the dist to your project directory - `mv jasmine/dist/jasmine-standalone-2.0.0.zip my-project/jasmine`
|
||||
* Move the dist to your project directory - `mv jasmine/dist/jasmine-standalone-{#.#.#}.zip my-project/jasmine`
|
||||
* Change directory - `cd my-project/jasmine`
|
||||
* Unzip the dist - `unzip jasmine-standalone-2.0.0.zip`
|
||||
* Unzip the dist - `unzip jasmine-standalone-{#.#.#}.zip`
|
||||
|
||||
Add the following to your HTML file:
|
||||
|
||||
```html
|
||||
<link rel="shortcut icon" type="image/png" href="jasmine/lib/jasmine-2.0.0/jasmine_favicon.png">
|
||||
<link rel="stylesheet" type="text/css" href="jasmine/lib/jasmine-2.0.0/jasmine.css">
|
||||
<link rel="shortcut icon" type="image/png" href="jasmine/lib/jasmine-core/jasmine_favicon.png">
|
||||
<link rel="stylesheet" type="text/css" href="jasmine/lib/jasmine-core/jasmine.css">
|
||||
|
||||
<script type="text/javascript" src="jasmine/lib/jasmine-2.0.0/jasmine.js"></script>
|
||||
<script type="text/javascript" src="jasmine/lib/jasmine-2.0.0/jasmine-html.js"></script>
|
||||
<script type="text/javascript" src="jasmine/lib/jasmine-2.0.0/boot.js"></script>
|
||||
<script type="text/javascript" src="jasmine/lib/jasmine-core/jasmine.js"></script>
|
||||
<script type="text/javascript" src="jasmine/lib/jasmine-core/jasmine-html.js"></script>
|
||||
<script type="text/javascript" src="jasmine/lib/jasmine-core/boot.js"></script>
|
||||
```
|
||||
|
||||
## Supported environments
|
||||
|
||||
@@ -1068,7 +1068,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
this.it = function(description, fn, timeout) {
|
||||
// it() sometimes doesn't have a fn argument, so only check the type if
|
||||
// it's given.
|
||||
if (arguments.length > 1) {
|
||||
if (arguments.length > 1 && typeof fn !== 'undefined') {
|
||||
ensureIsFunction(fn, 'it');
|
||||
}
|
||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||
@@ -1082,7 +1082,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
this.xit = function(description, fn, timeout) {
|
||||
// xit(), like it(), doesn't always have a fn argument, so only check the
|
||||
// type when needed.
|
||||
if (arguments.length > 1) {
|
||||
if (arguments.length > 1 && typeof fn !== 'undefined') {
|
||||
ensureIsFunction(fn, 'xit');
|
||||
}
|
||||
var spec = this.it.apply(this, arguments);
|
||||
@@ -1615,9 +1615,7 @@ getJasmineRequireObj().clearStack = function(j$) {
|
||||
}
|
||||
|
||||
function getClearStack(global) {
|
||||
if (global && global.process && j$.isFunction_(global.process.nextTick)) {
|
||||
return global.process.nextTick;
|
||||
} else if (j$.isFunction_(global.setImmediate)) {
|
||||
if (j$.isFunction_(global.setImmediate)) {
|
||||
var realSetImmediate = global.setImmediate;
|
||||
return function(fn) {
|
||||
realSetImmediate(fn);
|
||||
@@ -2176,7 +2174,7 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
|
||||
this.uninstall = function noop() {};
|
||||
|
||||
this.install = function install() {
|
||||
if (global.process && j$.isFunction_(global.process.on)) {
|
||||
if (global.process && global.process.listeners && j$.isFunction_(global.process.on)) {
|
||||
var originalHandlers = global.process.listeners('uncaughtException');
|
||||
global.process.removeAllListeners('uncaughtException');
|
||||
global.process.on('uncaughtException', onerror);
|
||||
@@ -2572,8 +2570,8 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
||||
}
|
||||
|
||||
var extraKeys = [];
|
||||
for (var i in allKeys) {
|
||||
if (!allKeys[i].match(/^[0-9]+$/)) {
|
||||
for (var i = 0; i < allKeys.length; i++) {
|
||||
if (!/^[0-9]+$/.test(allKeys[i])) {
|
||||
extraKeys.push(allKeys[i]);
|
||||
}
|
||||
}
|
||||
@@ -4224,15 +4222,10 @@ getJasmineRequireObj().Spy = function (j$) {
|
||||
* @name Spy
|
||||
*/
|
||||
function Spy(name, originalFn) {
|
||||
var args = buildArgs(),
|
||||
/*`eval` is the only option to preserve both this and context:
|
||||
- former is needed to work as expected with methods,
|
||||
- latter is needed to access real spy function and allows to reduce eval'ed code to absolute minimum
|
||||
More explanation here (look at comments): http://www.bennadel.com/blog/1909-javascript-function-constructor-does-not-create-a-closure.htm
|
||||
*/
|
||||
/* jshint evil: true */
|
||||
wrapper = eval('(0, function (' + args + ') { return spy.apply(this, Array.prototype.slice.call(arguments)); })'),
|
||||
/* jshint evil: false */
|
||||
var numArgs = (typeof originalFn === 'function' ? originalFn.length : 0),
|
||||
wrapper = makeFunc(numArgs, function () {
|
||||
return spy.apply(this, Array.prototype.slice.call(arguments));
|
||||
}),
|
||||
spyStrategy = new j$.SpyStrategy({
|
||||
name: name,
|
||||
fn: originalFn,
|
||||
@@ -4261,14 +4254,19 @@ getJasmineRequireObj().Spy = function (j$) {
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
function buildArgs() {
|
||||
var args = [];
|
||||
|
||||
while (originalFn instanceof Function && args.length < originalFn.length) {
|
||||
args.push('arg' + args.length);
|
||||
function makeFunc(length, fn) {
|
||||
switch (length) {
|
||||
case 1 : return function (a) { return fn.apply(this, arguments); };
|
||||
case 2 : return function (a,b) { return fn.apply(this, arguments); };
|
||||
case 3 : return function (a,b,c) { return fn.apply(this, arguments); };
|
||||
case 4 : return function (a,b,c,d) { return fn.apply(this, arguments); };
|
||||
case 5 : return function (a,b,c,d,e) { return fn.apply(this, arguments); };
|
||||
case 6 : return function (a,b,c,d,e,f) { return fn.apply(this, arguments); };
|
||||
case 7 : return function (a,b,c,d,e,f,g) { return fn.apply(this, arguments); };
|
||||
case 8 : return function (a,b,c,d,e,f,g,h) { return fn.apply(this, arguments); };
|
||||
case 9 : return function (a,b,c,d,e,f,g,h,i) { return fn.apply(this, arguments); };
|
||||
default : return function () { return fn.apply(this, arguments); };
|
||||
}
|
||||
|
||||
return args.join(', ');
|
||||
}
|
||||
|
||||
for (var prop in originalFn) {
|
||||
@@ -4939,5 +4937,5 @@ getJasmineRequireObj().TreeProcessor = function() {
|
||||
};
|
||||
|
||||
getJasmineRequireObj().version = function() {
|
||||
return '2.6.0';
|
||||
return '2.6.1';
|
||||
};
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
#
|
||||
module Jasmine
|
||||
module Core
|
||||
VERSION = "2.6.0"
|
||||
VERSION = "2.6.1"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jasmine-core",
|
||||
"license": "MIT",
|
||||
"version": "2.6.0",
|
||||
"version": "2.6.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jasmine/jasmine.git"
|
||||
|
||||
31
release_notes/2.6.1.md
Normal file
31
release_notes/2.6.1.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Jasmine 2.6.1 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This is a patch release to fix some regressions in the 2.6.0 release
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
* Update README.md to make installation instructions more version-agnostic
|
||||
- Merges #1319 from @reinrl
|
||||
|
||||
* Check for `process.listeners` as well, for GlobalErrors
|
||||
- Fixes #1333
|
||||
|
||||
* allow explicit undefined as function for `it` and `xit`
|
||||
- Merges #1329 from @UziTech
|
||||
- Fixes #1328
|
||||
|
||||
* remove eval to create spy wrapper
|
||||
- Merges #1330 from @UziTech
|
||||
- Fixes #1325
|
||||
|
||||
* iterate through keys with a regular for loop
|
||||
- Merges #1326 from @seanparmelee
|
||||
- Fixes #1321
|
||||
- Fixes #1324
|
||||
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
@@ -7,20 +7,6 @@ describe("ClearStack", function() {
|
||||
});
|
||||
});
|
||||
|
||||
it("uses nextTick when available", function() {
|
||||
var nextTick = jasmine.createSpy('nextTick').and.callFake(function(fn) { fn() }),
|
||||
global = { process: { nextTick: nextTick } },
|
||||
clearStack = jasmineUnderTest.getClearStack(global),
|
||||
called = false;
|
||||
|
||||
clearStack(function() {
|
||||
called = true;
|
||||
});
|
||||
|
||||
expect(called).toBe(true);
|
||||
expect(nextTick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses setImmediate when available", function() {
|
||||
var setImmediate = jasmine.createSpy('setImmediate').and.callFake(function(fn) { fn() }),
|
||||
global = { setImmediate: setImmediate },
|
||||
|
||||
@@ -82,8 +82,8 @@ describe("Env", function() {
|
||||
describe('#it', function () {
|
||||
it('throws an error when it receives a non-fn argument', function() {
|
||||
expect(function() {
|
||||
env.it('undefined arg', undefined);
|
||||
}).toThrowError(/it expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
||||
env.it('undefined arg', null);
|
||||
}).toThrowError(/it expects a function argument; received \[object (Null|DOMWindow|Object)\]/);
|
||||
});
|
||||
|
||||
it('does not throw when it is not given a fn argument', function() {
|
||||
@@ -105,8 +105,8 @@ describe("Env", function() {
|
||||
|
||||
it('throws an error when it receives a non-fn argument', function() {
|
||||
expect(function() {
|
||||
env.xit('undefined arg', undefined);
|
||||
}).toThrowError(/xit expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
||||
env.xit('undefined arg', null);
|
||||
}).toThrowError(/xit expects a function argument; received \[object (Null|DOMWindow|Object)\]/);
|
||||
});
|
||||
|
||||
it('does not throw when it is not given a fn argument', function() {
|
||||
|
||||
@@ -413,6 +413,53 @@ describe("matchersUtil", function() {
|
||||
var setB = new Set([6, 3]);
|
||||
expect(jasmineUnderTest.matchersUtil.equals(setA, setB)).toBe(false);
|
||||
});
|
||||
|
||||
describe("when running in an environment with array polyfills", function() {
|
||||
// IE 8 doesn't support `definePropery` on non-DOM nodes
|
||||
if (jasmine.getEnv().ieVersion < 9) { return; }
|
||||
|
||||
var findIndexDescriptor = Object.getOwnPropertyDescriptor(Array.prototype, 'findIndex');
|
||||
if (!findIndexDescriptor) {
|
||||
return;
|
||||
}
|
||||
|
||||
beforeEach(function() {
|
||||
Object.defineProperty(Array.prototype, 'findIndex', {
|
||||
enumerable: true,
|
||||
value: function (predicate) {
|
||||
if (this === null) {
|
||||
throw new TypeError('Array.prototype.findIndex called on null or undefined');
|
||||
}
|
||||
|
||||
if (typeof predicate !== 'function') {
|
||||
throw new TypeError('predicate must be a function');
|
||||
}
|
||||
|
||||
var list = Object(this);
|
||||
var length = list.length >>> 0;
|
||||
var thisArg = arguments[1];
|
||||
var value;
|
||||
|
||||
for (var i = 0; i < length; i++) {
|
||||
value = list[i];
|
||||
if (predicate.call(thisArg, value, i, list)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
Object.defineProperty(Array.prototype, 'findIndex', findIndexDescriptor);
|
||||
});
|
||||
|
||||
it("passes when there's an array polyfill", function() {
|
||||
expect(['foo']).toEqual(['foo']);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("contains", function() {
|
||||
|
||||
@@ -18,9 +18,7 @@ getJasmineRequireObj().clearStack = function(j$) {
|
||||
}
|
||||
|
||||
function getClearStack(global) {
|
||||
if (global && global.process && j$.isFunction_(global.process.nextTick)) {
|
||||
return global.process.nextTick;
|
||||
} else if (j$.isFunction_(global.setImmediate)) {
|
||||
if (j$.isFunction_(global.setImmediate)) {
|
||||
var realSetImmediate = global.setImmediate;
|
||||
return function(fn) {
|
||||
realSetImmediate(fn);
|
||||
|
||||
@@ -452,7 +452,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
this.it = function(description, fn, timeout) {
|
||||
// it() sometimes doesn't have a fn argument, so only check the type if
|
||||
// it's given.
|
||||
if (arguments.length > 1) {
|
||||
if (arguments.length > 1 && typeof fn !== 'undefined') {
|
||||
ensureIsFunction(fn, 'it');
|
||||
}
|
||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||
@@ -466,7 +466,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
this.xit = function(description, fn, timeout) {
|
||||
// xit(), like it(), doesn't always have a fn argument, so only check the
|
||||
// type when needed.
|
||||
if (arguments.length > 1) {
|
||||
if (arguments.length > 1 && typeof fn !== 'undefined') {
|
||||
ensureIsFunction(fn, 'xit');
|
||||
}
|
||||
var spec = this.it.apply(this, arguments);
|
||||
|
||||
@@ -11,7 +11,7 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
|
||||
this.uninstall = function noop() {};
|
||||
|
||||
this.install = function install() {
|
||||
if (global.process && j$.isFunction_(global.process.on)) {
|
||||
if (global.process && global.process.listeners && j$.isFunction_(global.process.on)) {
|
||||
var originalHandlers = global.process.listeners('uncaughtException');
|
||||
global.process.removeAllListeners('uncaughtException');
|
||||
global.process.on('uncaughtException', onerror);
|
||||
|
||||
@@ -14,15 +14,10 @@ getJasmineRequireObj().Spy = function (j$) {
|
||||
* @name Spy
|
||||
*/
|
||||
function Spy(name, originalFn) {
|
||||
var args = buildArgs(),
|
||||
/*`eval` is the only option to preserve both this and context:
|
||||
- former is needed to work as expected with methods,
|
||||
- latter is needed to access real spy function and allows to reduce eval'ed code to absolute minimum
|
||||
More explanation here (look at comments): http://www.bennadel.com/blog/1909-javascript-function-constructor-does-not-create-a-closure.htm
|
||||
*/
|
||||
/* jshint evil: true */
|
||||
wrapper = eval('(0, function (' + args + ') { return spy.apply(this, Array.prototype.slice.call(arguments)); })'),
|
||||
/* jshint evil: false */
|
||||
var numArgs = (typeof originalFn === 'function' ? originalFn.length : 0),
|
||||
wrapper = makeFunc(numArgs, function () {
|
||||
return spy.apply(this, Array.prototype.slice.call(arguments));
|
||||
}),
|
||||
spyStrategy = new j$.SpyStrategy({
|
||||
name: name,
|
||||
fn: originalFn,
|
||||
@@ -51,14 +46,19 @@ getJasmineRequireObj().Spy = function (j$) {
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
function buildArgs() {
|
||||
var args = [];
|
||||
|
||||
while (originalFn instanceof Function && args.length < originalFn.length) {
|
||||
args.push('arg' + args.length);
|
||||
function makeFunc(length, fn) {
|
||||
switch (length) {
|
||||
case 1 : return function (a) { return fn.apply(this, arguments); };
|
||||
case 2 : return function (a,b) { return fn.apply(this, arguments); };
|
||||
case 3 : return function (a,b,c) { return fn.apply(this, arguments); };
|
||||
case 4 : return function (a,b,c,d) { return fn.apply(this, arguments); };
|
||||
case 5 : return function (a,b,c,d,e) { return fn.apply(this, arguments); };
|
||||
case 6 : return function (a,b,c,d,e,f) { return fn.apply(this, arguments); };
|
||||
case 7 : return function (a,b,c,d,e,f,g) { return fn.apply(this, arguments); };
|
||||
case 8 : return function (a,b,c,d,e,f,g,h) { return fn.apply(this, arguments); };
|
||||
case 9 : return function (a,b,c,d,e,f,g,h,i) { return fn.apply(this, arguments); };
|
||||
default : return function () { return fn.apply(this, arguments); };
|
||||
}
|
||||
|
||||
return args.join(', ');
|
||||
}
|
||||
|
||||
for (var prop in originalFn) {
|
||||
|
||||
@@ -327,8 +327,8 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
||||
}
|
||||
|
||||
var extraKeys = [];
|
||||
for (var i in allKeys) {
|
||||
if (!allKeys[i].match(/^[0-9]+$/)) {
|
||||
for (var i = 0; i < allKeys.length; i++) {
|
||||
if (!/^[0-9]+$/.test(allKeys[i])) {
|
||||
extraKeys.push(allKeys[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user