This reverts commit f43bba8d59.
Adding randomness has introduced a lot of flakiness in our ember-cli tests. We should fix those issues at the source. However, given the upcoming stable release, this randomness has been reverted so that the stable release includes a stable test suite. Having a stable test suite on stable will make backporting future commits much easier.
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
import config from "../config/environment";
|
|
import { setEnvironment } from "discourse-common/config/environment";
|
|
import { start } from "ember-qunit";
|
|
import loadEmberExam from "ember-exam/test-support/load";
|
|
import * as QUnit from "qunit";
|
|
import { setup } from "qunit-dom";
|
|
|
|
setEnvironment("testing");
|
|
|
|
document.addEventListener("discourse-booted", () => {
|
|
const script = document.getElementById("plugin-test-script");
|
|
if (script && !requirejs.entries["discourse/tests/active-plugins"]) {
|
|
throw new Error(
|
|
`Plugin JS payload failed to load from ${script.src}. Is the Rails server running?`
|
|
);
|
|
}
|
|
|
|
let setupTests = require("discourse/tests/setup-tests").default;
|
|
const skippingCore =
|
|
new URLSearchParams(window.location.search).get("qunit_skip_core") === "1";
|
|
Ember.ENV.LOG_STACKTRACE_ON_DEPRECATION = false;
|
|
|
|
document.body.insertAdjacentHTML(
|
|
"afterbegin",
|
|
`
|
|
<div id="qunit"></div>
|
|
<div id="qunit-fixture"></div>
|
|
<div id="ember-testing-container" style="position: fixed">
|
|
<div id="ember-testing"></div>
|
|
</div>
|
|
`
|
|
);
|
|
|
|
setup(QUnit.assert);
|
|
setupTests(config.APP);
|
|
let loader = loadEmberExam();
|
|
loader.loadModules();
|
|
start({
|
|
setupTestContainer: false,
|
|
loadTests: false,
|
|
setupEmberOnerrorValidation: !skippingCore,
|
|
});
|
|
});
|
|
window.EmberENV.TESTS_FILE_LOADED = true;
|