Fix tests under IE
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import {indexOf} from './utils';
|
||||
|
||||
let logger = {
|
||||
methodMap: ['debug', 'info', 'warn', 'error'],
|
||||
level: 'info',
|
||||
@@ -5,7 +7,7 @@ let logger = {
|
||||
// Maps a given level value to the `methodMap` indexes above.
|
||||
lookupLevel: function(level) {
|
||||
if (typeof level === 'string') {
|
||||
let levelMap = logger.methodMap.indexOf(level.toLowerCase());
|
||||
let levelMap = indexOf(logger.methodMap, level.toLowerCase());
|
||||
if (levelMap >= 0) {
|
||||
level = levelMap;
|
||||
} else {
|
||||
|
||||
Vendored
+5
-5
@@ -61,12 +61,12 @@ global.shouldThrow = function(callback, type, msg) {
|
||||
try {
|
||||
callback();
|
||||
failed = true;
|
||||
} catch (err) {
|
||||
if (type && !(err instanceof type)) {
|
||||
throw new AssertError('Type failure: ' + err);
|
||||
} catch (caught) {
|
||||
if (type && !(caught instanceof type)) {
|
||||
throw new AssertError('Type failure: ' + caught);
|
||||
}
|
||||
if (msg && !(msg.test ? msg.test(err.message) : msg === err.message)) {
|
||||
throw new AssertError('Throw mismatch: Expected ' + err.message + ' to match ' + msg + '\n\n' + err.stack, shouldThrow);
|
||||
if (msg && !(msg.test ? msg.test(caught.message) : msg === caught.message)) {
|
||||
throw new AssertError('Throw mismatch: Expected ' + caught.message + ' to match ' + msg + '\n\n' + caught.stack, shouldThrow);
|
||||
}
|
||||
}
|
||||
if (failed) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Mocha</title>
|
||||
|
||||
+2
-1
@@ -215,7 +215,8 @@ describe('Regressions', function() {
|
||||
return 'found';
|
||||
}
|
||||
}
|
||||
return 'not';
|
||||
// And to make IE happy, check for the known string as length is not enumerated.
|
||||
return (this == 'bat' ? 'found' : 'not');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user