Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit c62c32c

Browse files
committed
test
1 parent f8fb95a commit c62c32c

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

lib/mocha/jasmine-bridge/jasmine.expect.ts

-10
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,6 @@ function getMatchers() {
135135
}
136136
} catch (error) {
137137
pass = !expected || eq(error, expected);
138-
if (!pass) {
139-
console.log('expected.message', expected instanceof Error, expected.message);
140-
console.log('expected.description', expected instanceof Error, expected.description);
141-
console.log('error.description', error instanceof Error, error.description);
142-
console.log('eq', error.message === expected.message);
143-
console.log('eq1', error.description === expected.description);
144-
console.log('eq2', eq(error, expected));
145-
console.log('eq3', !expected);
146-
console.log('eq4', !expected || eq(error, expected));
147-
}
148138
}
149139
return {pass};
150140
}

lib/mocha/jasmine-bridge/jasmine.util.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,13 @@ export function eq(a: any, b: any): boolean {
136136
if (b instanceof ObjectContaining) {
137137
return b.match(a);
138138
}
139-
if (Object.keys(a).length !== Object.keys(b).length) {
140-
return false;
141-
}
142139
if (a instanceof Error && b instanceof Error) {
143140
return getErrorMessage(a) === getErrorMessage(b) ||
144141
toMatch(getErrorMessage(a), getErrorMessage(b));
145142
}
143+
if (Object.keys(a).length !== Object.keys(b).length) {
144+
return false;
145+
}
146146
let isEqual = true;
147147

148148
for (let prop in a) {

lib/mocha/mocha-patch.ts

+4
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,12 @@ Zone.__load_patch('Mocha', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
138138
}
139139

140140
function wrapTestInZone(args: IArguments): any[] {
141+
const timeoutArgs = args.length > 0 ? args[args.length - 1] : null;
141142
const asyncTest = function(fn: Function) {
142143
return function(done: Function) {
144+
if (this && typeof this.timeout === 'function' && typeof timeoutArgs === 'number') {
145+
this.timeout(timeoutArgs);
146+
}
143147
fn = beforeTest(this, fn);
144148
return testZone.run(fn, this, [done]);
145149
};

0 commit comments

Comments
 (0)