ng-cache-testing-module
Version:
Cache Angular's testing modules to improve performance.
41 lines (40 loc) • 1.56 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var testing_1 = require("@angular/core/testing");
function cacheTestingModule() {
var realResetTestingModule = testing_1.TestBed.resetTestingModule;
var realConfigureTestingModule = testing_1.TestBed.configureTestingModule;
beforeAll(function () {
var initialized = false;
var testBedStatic;
testing_1.TestBed.configureTestingModule = function (moduleDef) {
if (!initialized) {
initialized = true;
testBedStatic = realConfigureTestingModule(moduleDef);
}
return testBedStatic;
};
testing_1.TestBed.resetTestingModule();
testing_1.TestBed.resetTestingModule = function () { return testing_1.TestBed; };
});
afterAll(function () {
testing_1.TestBed.configureTestingModule = realConfigureTestingModule;
testing_1.TestBed.resetTestingModule = realResetTestingModule;
testing_1.TestBed.resetTestingModule();
});
afterEach(function () {
var testBed = testing_1.getTestBed();
testBed._activeFixtures.forEach(function (fixture) {
return fixture.destroy();
});
// reset ViewEngine TestBed
testBed._instantiated = false;
// reset Ivy TestBed
testBed._testModuleRef = null;
});
}
exports.cacheTestingModule = cacheTestingModule;
function default_1() {
console.log("AAAAAAAAAAAA");
}
exports.default = default_1;