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:
Justin Ridgewell
2020-08-10 18:57:48 -04:00
committed by GitHub
parent 3bff1ce35a
commit a5bc48661b
14 changed files with 175 additions and 143 deletions

View File

@@ -1,13 +1,9 @@
var a = (() => [1, 2, 3])();
// Simulate old environment
let _Symbol = Symbol;
Symbol = void 0;
try {
var [first, ...rest] = a;
global.Symbol = void 0;
expect(first).toBe(1);
expect(rest).toEqual([2, 3]);
} finally {
Symbol = _Symbol;
}
var [first, ...rest] = a;
expect(first).toBe(1);
expect(rest).toEqual([2, 3]);

View File

@@ -8,15 +8,8 @@ expect(
() => [foo, bar] = {}
).toThrow(/destructure non-iterable/);
// Simulate old browser
let _Symbol = Symbol;
Symbol = void 0;
try {
global.Symbol = void 0;
expect(
() => [foo, bar] = {}
).toThrow(/destructure non-iterable/);
} finally {
Symbol = _Symbol;
}
expect(
() => [foo, bar] = {}
).toThrow(/destructure non-iterable/);