diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/env/common.js | 10 | ||||
-rw-r--r-- | spec/index.html | 1 | ||||
-rw-r--r-- | spec/regressions.js | 3 |
3 files changed, 8 insertions, 6 deletions
diff --git a/spec/env/common.js b/spec/env/common.js index 2a24db2..e378052 100644 --- a/spec/env/common.js +++ b/spec/env/common.js @@ -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) { diff --git a/spec/index.html b/spec/index.html index 348ae89..5db2146 100644 --- a/spec/index.html +++ b/spec/index.html @@ -1,3 +1,4 @@ +<!doctype html> <html> <head> <title>Mocha</title> diff --git a/spec/regressions.js b/spec/regressions.js index 931fc4b..bd0a111 100644 --- a/spec/regressions.js +++ b/spec/regressions.js @@ -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'); } }; |