Load the non-test files with standard import statements when running the unit-tests

The unit-test files themselves shouldn't be loaded until Jasmine has been setup/configured, however that doesn't matter for the "normal" PDF.js library files. Hence we can simply `import` them in the standard way.
This commit is contained in:
Jonas Jenwald 2020-10-27 11:41:54 +01:00
parent 8eeb0bcbe4
commit 92477333f6
2 changed files with 9 additions and 13 deletions

View File

@ -4,6 +4,9 @@
],
"rules": {
// Plugins
"import/no-unresolved": ["error", { "ignore": ["pdfjs/"] }],
// ECMAScript 6
"no-var": "error",
},

View File

@ -40,16 +40,16 @@
"use strict";
import { GlobalWorkerOptions } from "pdfjs/display/worker_options.js";
import { isNodeJS } from "pdfjs/shared/is_node.js";
import { PDFFetchStream } from "pdfjs/display/fetch_stream.js";
import { PDFNetworkStream } from "pdfjs/display/network.js";
import { setPDFNetworkStreamFactory } from "pdfjs/display/api.js";
import { TestReporter } from "./testreporter.js";
async function initializePDFJS(callback) {
const modules = await Promise.all(
await Promise.all(
[
"pdfjs/display/api.js",
"pdfjs/display/worker_options.js",
"pdfjs/display/network.js",
"pdfjs/display/fetch_stream.js",
"pdfjs/shared/is_node.js",
"pdfjs-test/unit/annotation_spec.js",
"pdfjs-test/unit/annotation_storage_spec.js",
"pdfjs-test/unit/api_spec.js",
@ -89,13 +89,6 @@ async function initializePDFJS(callback) {
return import(moduleName);
})
);
const [
{ setPDFNetworkStreamFactory },
{ GlobalWorkerOptions },
{ PDFNetworkStream },
{ PDFFetchStream },
{ isNodeJS },
] = modules;
if (isNodeJS) {
throw new Error(