This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/test-helper.js
David Taylor 88fa8b5848
DEV: Skip Ember OnError validation for plugin qunit tests (#15314)
If the Ember OnError validation test is added, it breaks the "no tests were run" detection (since at least 1 test is always run). This is particularly important when running tests scoped to a single plugin, because there is no indication that you have typo'd the `qunit_single_plugin` query parameter.
2021-12-15 10:59:38 +00:00

37 lines
1.0 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", () => {
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,
});
});