mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Some tests rely on the presence of a server that serves PDF files. When tests are run from a web browser, the test files and PDF files are served by the same server (WebServer), but in Node.js that server is not around. Currently, the tests that depend on it start a minimal Node.js server that re-implements part of the functionality from WebServer. To avoid code duplication when tests depend on more complex behaviors, this patch replaces createTemporaryNodeServer with the existing WebServer, wrapped in a new test utility that has the same interface in Node.js and non-Node.js environments (=TestPdfsServer). This patch has been tested by running the refactored tests in the following three configurations: 1. From the browser: - http://localhost:8888/test/unit/unit_test.html?spec=api - http://localhost:8888/test/unit/unit_test.html?spec=fetch_stream 2. Run specific tests directly with jasmine without legacy bundling: `JASMINE_CONFIG_PATH=test/unit/clitests.json ./node_modules/.bin/jasmine --filter='^api|^fetch_stream'` 3. `gulp unittestcli` |
||
---|---|---|
.. | ||
chromium | ||
font | ||
fuzz | ||
images | ||
integration | ||
pdfs | ||
resources | ||
stats | ||
types | ||
unit | ||
.gitignore | ||
add_test.mjs | ||
annotation_layer_builder_overrides.css | ||
downloadutils.mjs | ||
draw_layer_test.css | ||
driver.js | ||
integration-boot.mjs | ||
test.mjs | ||
test_manifest.json | ||
test_slave.html | ||
testutils.mjs | ||
text_layer_test.css | ||
webserver.mjs | ||
xfa_layer_builder_overrides.css |