DEV: Stop live-reloading locally on SCSS changes (#16193)

The `testem.scss` include triggers a live reload locally. We need these
styles when running `ember test --server`, so this loads that stylesheet
only in that scenario.
This commit is contained in:
Penar Musaraj 2022-03-15 16:46:12 +01:00 committed by GitHub
parent 593f3e5dd8
commit d19b5fe80b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,8 @@ module.exports = function (defaults) {
let vendorJs = discourseRoot + "/vendor/assets/javascripts/"; let vendorJs = discourseRoot + "/vendor/assets/javascripts/";
const isProduction = EmberApp.env().includes("production"); const isProduction = EmberApp.env().includes("production");
const isTest = EmberApp.env().includes("test");
let app = new EmberApp(defaults, { let app = new EmberApp(defaults, {
autoRun: false, autoRun: false,
"ember-qunit": { "ember-qunit": {
@ -91,7 +93,15 @@ module.exports = function (defaults) {
sourceMapConfig: false, sourceMapConfig: false,
}); });
return mergeTrees([tests, testHelpers]); if (isTest) {
return mergeTrees([
tests,
testHelpers,
discourseScss(`${discourseRoot}/app/assets/stylesheets`, "testem.scss"),
]);
} else {
return mergeTrees([tests, testHelpers]);
}
}; };
// WARNING: We should only import scripts here if they are not in NPM. // WARNING: We should only import scripts here if they are not in NPM.
@ -110,7 +120,6 @@ module.exports = function (defaults) {
); );
const mergedTree = mergeTrees([ const mergedTree = mergeTrees([
discourseScss(`${discourseRoot}/app/assets/stylesheets`, "testem.scss"),
createI18nTree(discourseRoot, vendorJs), createI18nTree(discourseRoot, vendorJs),
app.toTree(), app.toTree(),
funnel(`${discourseRoot}/public/javascripts`, { destDir: "javascripts" }), funnel(`${discourseRoot}/public/javascripts`, { destDir: "javascripts" }),