| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
`assert.throws()` and `assert.doesNotThrow()` blow up with a `TypeError` if used with an ES6 class that extends Error. Fixes: nodejs#3188
|
Without the change to lib/assert.js, the test added here results in this: assert.js:90
throw new assert.AssertionError({
^
AssertionError: expected AnotherErrorType, received TypeError: Class constructors cannot be invoked without 'new'
at Object.<anonymous> (/tmp/node/test/parallel/test-assert.js:362:3)
at Module._compile (module.js:399:26)
at Object.Module._extensions..js (module.js:406:10)
at Module.load (module.js:345:32)
at Function.Module._load (module.js:302:12)
at Function.Module.runMain (module.js:431:10)
at startup (node.js:138:18)
at node.js:976:3
With the change here to lib/assert.js, the test passes, of course. |
Sorry, something went wrong.
|
Pre-emptive strike: Yes, the Assert API is Locked. That means: Only fixes related to security, performance, or bug fixes will be accepted. This is a bug fix. The docs say that assert.throws() can take a constructor but it blows up if it is an ES6 class constructor. This fixes that issue. (The alternative is to update the docs to indicate that ES6 classes are not OK. I'd prefer this change, although we may also want to amend the docs to indicate that the constructor should be a constructor that inherits from Error.) |
Sorry, something went wrong.
Sorry, something went wrong.
|
LGTM. There was a problem with the centos5-64 buildbot, probably a stray process hogging a port. |
Sorry, something went wrong.
`assert.throws()` and `assert.doesNotThrow()` blow up with a `TypeError` if used with an ES6 class that extends Error. Fixes: nodejs#3188 PR-URL: nodejs#4166 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
`assert.throws()` and `assert.doesNotThrow()` blow up with a `TypeError` if used with an ES6 class that extends Error. Fixes: nodejs#3188 PR-URL: nodejs#4166 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Notable changes: * assert - accommodate ES6 classes that extend Error (Rich Trott) #4166 * build - add "--partly-static" build options (Super Zheng) #4152 * deps - backport 066747e from upstream V8 (Ali Ijaz Sheikh) #4655 - backport 200315c from V8 upstream (Vladimir Kurchatkin) #4128 - upgrade libuv to 1.8.0 (Saúl Ibarra Corretgé) * docs - various updates landed in 70 different commits! * repl - attach location info to syntax errors (cjihrig) #4013 - display error message when loading directory (Prince J Wesley) #4170 * tests - various updates landed in over 50 commits * util - allow lookup of hidden values (cjihrig) #3988
Notable changes: * assert - accommodate ES6 classes that extend Error (Rich Trott) #4166 * build - add "--partly-static" build options (Super Zheng) #4152 * deps - backport 066747e from upstream V8 (Ali Ijaz Sheikh) #4655 - backport 200315c from V8 upstream (Vladimir Kurchatkin) #4128 - upgrade libuv to 1.8.0 (Saúl Ibarra Corretgé) * docs - various updates landed in 70 different commits! * repl - attach location info to syntax errors (cjihrig) #4013 - display error message when loading directory (Prince J Wesley) #4170 * tests - various updates landed in over 50 commits * util - allow lookup of hidden values (cjihrig) #3988 PR-URL: #4768
Notable changes: * assert - accommodate ES6 classes that extend Error (Rich Trott) #4166 * build - add "--partly-static" build options (Super Zheng) #4152 * deps - backport 066747e from upstream V8 (Ali Ijaz Sheikh) #4655 - backport 200315c from V8 upstream (Vladimir Kurchatkin) #4128 - upgrade libuv to 1.8.0 (Saúl Ibarra Corretgé) * docs - various updates landed in 70 different commits! * repl - attach location info to syntax errors (cjihrig) #4013 - display error message when loading directory (Prince J Wesley) #4170 * tests - various updates landed in over 50 commits * util - allow lookup of hidden values (cjihrig) #3988 PR-URL: #4768
`assert.throws()` and `assert.doesNotThrow()` blow up with a `TypeError` if used with an ES6 class that extends Error. Fixes: nodejs#3188 PR-URL: nodejs#4166 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Notable changes: * assert - accommodate ES6 classes that extend Error (Rich Trott) nodejs#4166 * build - add "--partly-static" build options (Super Zheng) nodejs#4152 * deps - backport 066747e from upstream V8 (Ali Ijaz Sheikh) nodejs#4655 - backport 200315c from V8 upstream (Vladimir Kurchatkin) nodejs#4128 - upgrade libuv to 1.8.0 (Saúl Ibarra Corretgé) * docs - various updates landed in 70 different commits! * repl - attach location info to syntax errors (cjihrig) nodejs#4013 - display error message when loading directory (Prince J Wesley) nodejs#4170 * tests - various updates landed in over 50 commits * util - allow lookup of hidden values (cjihrig) nodejs#3988 PR-URL: nodejs#4768
| Back | FazBrowse Home | New Git URL |
assert.throws() and assert.doesNotThrow() blow up with a TypeError
if used with an ES6 class that extends Error.
Fixes: #3188