jest-jasmine2
Advanced tools
Comparing version
@@ -118,38 +118,2 @@ /** | ||
const hasIterator = object => !!(object != null && object[Symbol.iterator]); | ||
const iterableEquality = (a, b) => { | ||
if ( | ||
typeof a !== 'object' || | ||
typeof b !== 'object' || | ||
Array.isArray(a) || | ||
Array.isArray(b) || | ||
!hasIterator(a) || | ||
!hasIterator(b)) | ||
{ | ||
return undefined; | ||
} | ||
if (a.constructor !== b.constructor) { | ||
return false; | ||
} | ||
const bIterator = b[Symbol.iterator](); | ||
for (const aValue of a) { | ||
const nextB = bIterator.next(); | ||
if ( | ||
nextB.done || | ||
!jasmine.matchersUtil.equals( | ||
aValue, | ||
nextB.value, | ||
[iterableEquality])) | ||
{ | ||
return false; | ||
} | ||
} | ||
if (!bIterator.next().done) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
runtime.setMock( | ||
@@ -166,3 +130,2 @@ '', | ||
env.beforeEach(() => { | ||
jasmine.addCustomEqualityTester(iterableEquality); | ||
jasmine.addMatchers({ | ||
@@ -172,3 +135,2 @@ toMatchSnapshot: snapshot.matcher( | ||
config, | ||
jasmine, | ||
snapshotState) }); | ||
@@ -179,33 +141,2 @@ | ||
jasmine.addMatchers({ | ||
toBeCalled: () => ({ | ||
compare: (actual, expected) => { | ||
if (expected) { | ||
throw Error( | ||
'toBeCalled() does not accept parameters, use ' + | ||
'toBeCalledWith instead.'); | ||
} | ||
const isSpy = isSpyLike(actual); | ||
if (!isSpy && !isMockLike(actual)) { | ||
throw Error( | ||
'toBeCalled() should be used on a mock function or ' + | ||
'a jasmine spy.'); | ||
} | ||
const calls = isSpy ? | ||
actual.calls.all().map(x => x.args) : | ||
actual.mock.calls; | ||
const pass = calls.length !== 0; | ||
const message = | ||
pass ? | ||
'Expected not to be called' : | ||
'Expected to be called at least once'; | ||
return { | ||
pass, | ||
message }; | ||
} }), | ||
lastCalledWith: util => ({ | ||
@@ -212,0 +143,0 @@ compare(actual) { |
{ | ||
"name": "jest-jasmine2", | ||
"version": "14.2.2-alpha.22bd3c33", | ||
"version": "14.3.0-alpha.d13c163e", | ||
"repository": { | ||
@@ -13,5 +13,5 @@ "type": "git", | ||
"jasmine-check": "^0.1.4", | ||
"jest-matchers": "^14.2.2-alpha.22bd3c33", | ||
"jest-snapshot": "^14.2.2-alpha.22bd3c33", | ||
"jest-util": "^14.2.2-alpha.22bd3c33" | ||
"jest-matchers": "^14.3.0-alpha.d13c163e", | ||
"jest-snapshot": "^14.3.0-alpha.d13c163e", | ||
"jest-util": "^14.3.0-alpha.d13c163e" | ||
}, | ||
@@ -18,0 +18,0 @@ "scripts": { |
107202
-1.51%3219
-1.83%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed