Isolated exec tests (#11531)
* Run exec tests in fresh contexts * Reevaluate modules in every context * Cache module code when running tests * Eliminate weakmap accesses as much as possible * Remove old multiline usage * Using bundled polyfill to significantly increase performance The individual requires for each file were the part that was sooooo slow. * Drop LRU cache size * Fixes * Fix test Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
This commit is contained in:
@@ -1,26 +1,15 @@
|
||||
const oldReflect = this.Reflect;
|
||||
const oldHTMLElement = this.HTMLElement;
|
||||
// Pretend that `Reflect.construct` isn't supported.
|
||||
global.Reflect = undefined;
|
||||
|
||||
try {
|
||||
// Pretend that `Reflect.construct` isn't supported.
|
||||
this.Reflect = undefined;
|
||||
global.HTMLElement = function() {
|
||||
// Here, `this.HTMLElement` is this function, not the original HTMLElement
|
||||
// constructor. `this.constructor` should be this function too, but isn't.
|
||||
constructor = this.constructor;
|
||||
};
|
||||
|
||||
this.HTMLElement = function() {
|
||||
// Here, `this.HTMLElement` is this function, not the original HTMLElement
|
||||
// constructor. `this.constructor` should be this function too, but isn't.
|
||||
constructor = this.constructor;
|
||||
};
|
||||
|
||||
var constructor;
|
||||
|
||||
class CustomElement extends HTMLElement {};
|
||||
new CustomElement();
|
||||
|
||||
expect(constructor).toBe(CustomElement);
|
||||
} finally {
|
||||
// Restore original env
|
||||
this.Reflect = oldReflect;
|
||||
this.HTMLElement = oldHTMLElement;
|
||||
}
|
||||
var constructor;
|
||||
|
||||
class CustomElement extends HTMLElement {}
|
||||
new CustomElement();
|
||||
|
||||
expect(constructor).toBe(CustomElement);
|
||||
|
||||
Reference in New Issue
Block a user