Don't call afterEach within beforeEach (#46963)

Otherwise, a new afterEach handler is added for each test case and the
number of handlers run grows quadratically.
This commit is contained in:
Andrew Casey 2021-11-30 15:08:42 -08:00 committed by GitHub
parent cdf12f91c7
commit b8ec791ca1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 10 deletions

View File

@ -130,9 +130,9 @@ namespace ts {
}
MapShim = ShimCollections.createMapShim(getIterator);
afterEach(() => {
MapShim = undefined!;
});
});
afterEach(() => {
MapShim = undefined!;
});
it("iterates values in insertion order and handles changes with string keys", () => {

View File

@ -128,9 +128,9 @@ namespace ts {
}
SetShim = ShimCollections.createSetShim(getIterator);
afterEach(() => {
SetShim = undefined!;
});
});
afterEach(() => {
SetShim = undefined!;
});
it("iterates values in insertion order and handles changes with string keys", () => {

View File

@ -1,10 +1,12 @@
namespace ts {
describe("unittests:: debugDeprecation", () => {
let loggingHost: LoggingHost | undefined;
beforeEach(() => {
const loggingHost = Debug.loggingHost;
afterEach(() => {
Debug.loggingHost = loggingHost;
});
loggingHost = Debug.loggingHost;
});
afterEach(() => {
Debug.loggingHost = loggingHost;
loggingHost = undefined;
});
describe("deprecateFunction", () => {
it("silent deprecation", () => {