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(); User.resetCurrent();
resetMobile();
resetExtraClasses(); resetExtraClasses();
clearOutletCache(); clearOutletCache();
clearHTMLCache(); clearHTMLCache();
@ -249,6 +250,7 @@ export function testCleanup(container, app) {
rollbackAllPrepends(); rollbackAllPrepends();
clearAboutPageActivities(); clearAboutPageActivities();
clearLegacyAboutPageStats(); clearLegacyAboutPageStats();
resetWidgetCleanCallbacks();
} }
function cleanupCssGeneratorTags() { function cleanupCssGeneratorTags() {
@ -344,8 +346,6 @@ export function acceptance(name, optionsOrCallback) {
beforeEach() { beforeEach() {
I18n.testing = true; I18n.testing = true;
resetMobile();
resetExtraClasses(); resetExtraClasses();
if (mobileView) { if (mobileView) {
forceMobile(); forceMobile();
@ -381,16 +381,10 @@ export function acceptance(name, optionsOrCallback) {
afterEach() { afterEach() {
I18n.testing = false; I18n.testing = false;
resetMobile();
let app = getApplication();
options?.afterEach?.call(this); options?.afterEach?.call(this);
if (loggedIn) { if (loggedIn) {
User.current().statusManager.stopTrackingStatus(); 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 { assert, module, test } from "qunit";
import sinon from "sinon"; import sinon from "sinon";
import { overrideThrowGjsError } from "discourse/instance-initializers/component-templates"; 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 { setupRenderingTest } from "discourse/tests/helpers/component-test";
import { registerTemporaryModule } from "../helpers/temporary-module-helper"; import { registerTemporaryModule } from "../helpers/temporary-module-helper";
@ -139,7 +139,6 @@ module("Integration | Initializers | plugin-component-templates", function () {
registerBaseComponents(); registerBaseComponents();
forceMobile(); forceMobile();
}); });
hooks.afterEach(resetMobile);
setupRenderingTest(hooks); setupRenderingTest(hooks);
@ -176,7 +175,6 @@ module("Integration | Initializers | plugin-component-templates", function () {
forceMobile(); forceMobile();
registerBaseComponents(); registerBaseComponents();
}); });
hooks.afterEach(resetMobile);
setupRenderingTest(hooks); setupRenderingTest(hooks);