Skip to content

Commit 3c8ee25

Browse files
authored
Merge pull request #13911 from Snuffleupagus/gulpfile-fix-TESTING-define
Ensure that the `TESTING` define can always be overridden in `gulpfile.js`
2 parents a936509 + 88d39e5 commit 3c8ee25

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

gulpfile.js

+14-4
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const AUTOPREFIXER_CONFIG = {
9090
const DEFINES = Object.freeze({
9191
PRODUCTION: true,
9292
SKIP_BABEL: true,
93-
TESTING: false,
93+
TESTING: undefined,
9494
// The main build targets:
9595
GENERIC: false,
9696
MOZCENTRAL: false,
@@ -179,7 +179,10 @@ function createWebpackConfig(
179179
const bundleDefines = builder.merge(defines, {
180180
BUNDLE_VERSION: versionInfo.version,
181181
BUNDLE_BUILD: versionInfo.commit,
182-
TESTING: defines.TESTING || process.env.TESTING === "true",
182+
TESTING:
183+
defines.TESTING !== undefined
184+
? defines.TESTING
185+
: process.env.TESTING === "true",
183186
DEFAULT_PREFERENCES: defaultPreferencesDir
184187
? getDefaultPreferences(defaultPreferencesDir)
185188
: {},
@@ -677,7 +680,10 @@ function buildDefaultPreferences(defines, dir) {
677680
SKIP_BABEL: false,
678681
BUNDLE_VERSION: 0, // Dummy version
679682
BUNDLE_BUILD: 0, // Dummy build
680-
TESTING: defines.TESTING || process.env.TESTING === "true",
683+
TESTING:
684+
defines.TESTING !== undefined
685+
? defines.TESTING
686+
: process.env.TESTING === "true",
681687
});
682688

683689
const inputStream = merge([
@@ -1452,7 +1458,10 @@ function buildLib(defines, dir) {
14521458
const bundleDefines = builder.merge(defines, {
14531459
BUNDLE_VERSION: versionInfo.version,
14541460
BUNDLE_BUILD: versionInfo.commit,
1455-
TESTING: defines.TESTING || process.env.TESTING === "true",
1461+
TESTING:
1462+
defines.TESTING !== undefined
1463+
? defines.TESTING
1464+
: process.env.TESTING === "true",
14561465
DEFAULT_PREFERENCES: getDefaultPreferences(
14571466
defines.SKIP_BABEL ? "lib/" : "lib-legacy/"
14581467
),
@@ -1824,6 +1833,7 @@ gulp.task(
18241833
const defines = builder.merge(DEFINES, {
18251834
CHROME: true,
18261835
SKIP_BABEL: false,
1836+
TESTING: false,
18271837
});
18281838
return buildDefaultPreferences(defines, "lint-chromium/");
18291839
},

web/app_options.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ const defaultOptions = {
226226
},
227227
enableXfa: {
228228
/** @type {boolean} */
229-
value: typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION"),
229+
value:
230+
typeof PDFJSDev === "undefined" ||
231+
PDFJSDev.test("!PRODUCTION || TESTING"),
230232
kind: OptionKind.API + OptionKind.PREFERENCE,
231233
},
232234
fontExtraProperties: {

0 commit comments

Comments
 (0)