From 1f468e523fdc775ca7ee75f515b0f05630d9b6d8 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 19 Aug 2021 19:54:36 +0200 Subject: [PATCH] Ensure that the `TESTING` define can always be overridden in `gulpfile.js` Currently a `TESTING = true` environment variable will *always* take precedence in the various build-tasks, and there's no way to explicitly disable it for a particular build. That's clearly an oversight on my part, however it's easy enough to fix this; sorry about breaking this! --- gulpfile.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index df44b7b01..61d7b1acc 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -90,7 +90,7 @@ const AUTOPREFIXER_CONFIG = { const DEFINES = Object.freeze({ PRODUCTION: true, SKIP_BABEL: true, - TESTING: false, + TESTING: undefined, // The main build targets: GENERIC: false, MOZCENTRAL: false, @@ -179,7 +179,10 @@ function createWebpackConfig( const bundleDefines = builder.merge(defines, { BUNDLE_VERSION: versionInfo.version, BUNDLE_BUILD: versionInfo.commit, - TESTING: defines.TESTING || process.env.TESTING === "true", + TESTING: + defines.TESTING !== undefined + ? defines.TESTING + : process.env.TESTING === "true", DEFAULT_PREFERENCES: defaultPreferencesDir ? getDefaultPreferences(defaultPreferencesDir) : {}, @@ -677,7 +680,10 @@ function buildDefaultPreferences(defines, dir) { SKIP_BABEL: false, BUNDLE_VERSION: 0, // Dummy version BUNDLE_BUILD: 0, // Dummy build - TESTING: defines.TESTING || process.env.TESTING === "true", + TESTING: + defines.TESTING !== undefined + ? defines.TESTING + : process.env.TESTING === "true", }); const inputStream = merge([ @@ -1452,7 +1458,10 @@ function buildLib(defines, dir) { const bundleDefines = builder.merge(defines, { BUNDLE_VERSION: versionInfo.version, BUNDLE_BUILD: versionInfo.commit, - TESTING: defines.TESTING || process.env.TESTING === "true", + TESTING: + defines.TESTING !== undefined + ? defines.TESTING + : process.env.TESTING === "true", DEFAULT_PREFERENCES: getDefaultPreferences( defines.SKIP_BABEL ? "lib/" : "lib-legacy/" ), @@ -1824,6 +1833,7 @@ gulp.task( const defines = builder.merge(DEFINES, { CHROME: true, SKIP_BABEL: false, + TESTING: false, }); return buildDefaultPreferences(defines, "lint-chromium/"); },