DEV: Avoid extra after-test cleanup (#28846)

This commit is contained in:
Jarek Radosz 2024-09-11 13:43:19 +02:00 committed by GitHub
parent 6a677d1cfc
commit 2c80203ab9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 11 deletions

View File

@ -187,6 +187,7 @@ export function testCleanup(container, app) {
}
User.resetCurrent();
resetMobile();
resetExtraClasses();
clearOutletCache();
clearHTMLCache();
@ -249,6 +250,7 @@ export function testCleanup(container, app) {
rollbackAllPrepends();
clearAboutPageActivities();
clearLegacyAboutPageStats();
resetWidgetCleanCallbacks();
}
function cleanupCssGeneratorTags() {
@ -344,8 +346,6 @@ export function acceptance(name, optionsOrCallback) {
beforeEach() {
I18n.testing = true;
resetMobile();
resetExtraClasses();
if (mobileView) {
forceMobile();
@ -381,16 +381,10 @@ export function acceptance(name, optionsOrCallback) {
afterEach() {
I18n.testing = false;
resetMobile();
let app = getApplication();
options?.afterEach?.call(this);
if (loggedIn) {
User.current().statusManager.stopTrackingStatus();
}
testCleanup(this.container, app);
// We do this after reset so that the willClearRender will have already fired
resetWidgetCleanCallbacks();
},
};

View File

@ -5,7 +5,7 @@ import { hbs } from "ember-cli-htmlbars";
import { assert, module, test } from "qunit";
import sinon from "sinon";
import { overrideThrowGjsError } from "discourse/instance-initializers/component-templates";
import { forceMobile, resetMobile } from "discourse/lib/mobile";
import { forceMobile } from "discourse/lib/mobile";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import { registerTemporaryModule } from "../helpers/temporary-module-helper";
@ -139,7 +139,6 @@ module("Integration | Initializers | plugin-component-templates", function () {
registerBaseComponents();
forceMobile();
});
hooks.afterEach(resetMobile);
setupRenderingTest(hooks);
@ -176,7 +175,6 @@ module("Integration | Initializers | plugin-component-templates", function () {
forceMobile();
registerBaseComponents();
});
hooks.afterEach(resetMobile);
setupRenderingTest(hooks);