mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +02:00
Add a TESTING build option, to enable using non-production/test-only code-paths
Since the tests (currently) run with the `pdf.worker.js` file built, i.e. with `PRODUCTION = true` set, there's no simple way to add e.g. `assert` calls for both non-production *and* test-only builds without also affecting PRODUCTION builds.
This commit is contained in:
parent
f01e54eae1
commit
4b69bb7fe9
3 changed files with 24 additions and 12 deletions
|
@ -379,8 +379,10 @@ var WorkerMessageHandler = {
|
|||
let apiVersion = docParams.apiVersion;
|
||||
let workerVersion =
|
||||
typeof PDFJSDev !== 'undefined' ? PDFJSDev.eval('BUNDLE_VERSION') : null;
|
||||
// The `apiVersion !== null` check is needed to avoid errors during testing.
|
||||
if (apiVersion !== null && apiVersion !== workerVersion) {
|
||||
if ((typeof PDFJSDev !== 'undefined' && PDFJSDev.test('TESTING')) &&
|
||||
apiVersion === null) {
|
||||
warn('Ignoring apiVersion/workerVersion check in TESTING builds.');
|
||||
} else if (apiVersion !== workerVersion) {
|
||||
throw new Error(`The API version "${apiVersion}" does not match ` +
|
||||
`the Worker version "${workerVersion}".`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue