NOTE: There's a problem with this check in JSDOM leading so we have to disable this in test environment
JSDOM uses their own isolated object rather than native object for performance purpose
See https://github.com/jsdom/jsdom/issues/3082
For example, TypeErrors generated by webidl2js or whatwg-url used by jsdom, or manually-thrown ones inside impl classes,
are thrown using global.TypeError, not dom.window.TypeError. This change is hard to implement as of now
See https://github.com/jsdom/jsdom/issues/2727
See https://github.com/facebook/jest/issues/2549
This is a relatively crude way to handle error of type unknown thrown for now. We should revisit this when Typescript supports
throws
clause See https://github.com/microsoft/TypeScript/issues/13219NOTE: There's a problem with this check in JSDOM leading so we have to disable this in test environment JSDOM uses their own isolated object rather than native object for performance purpose See https://github.com/jsdom/jsdom/issues/3082 For example, TypeErrors generated by
webidl2js
orwhatwg-url
used byjsdom
, or manually-thrown ones inside impl classes, are thrown using global.TypeError, not dom.window.TypeError. This change is hard to implement as of now See https://github.com/jsdom/jsdom/issues/2727 See https://github.com/facebook/jest/issues/2549Read more related discussions at: https://github.com/jsdom/jsdom/issues/1737 https://github.com/webcomponents/polyfills/issues/105 https://github.com/jsdom/jsdom/issues/1769 https://github.com/jsdom/jsdom/issues/2555