mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Utilize PDFNodeStream
to run more API unit-tests on Node.js/Travis
This commit is contained in:
parent
fd242ad2c2
commit
42c71cd99f
5 changed files with 42 additions and 13 deletions
|
@ -46,6 +46,7 @@ function initializePDFJS(callback) {
|
|||
'pdfjs/display/api',
|
||||
'pdfjs/display/network',
|
||||
'pdfjs/display/fetch_stream',
|
||||
'pdfjs/shared/is_node',
|
||||
'pdfjs-test/unit/annotation_spec',
|
||||
'pdfjs-test/unit/api_spec',
|
||||
'pdfjs-test/unit/bidi_spec',
|
||||
|
@ -81,8 +82,13 @@ function initializePDFJS(callback) {
|
|||
var displayApi = modules[1];
|
||||
var PDFNetworkStream = modules[2].PDFNetworkStream;
|
||||
var PDFFetchStream = modules[3].PDFFetchStream;
|
||||
const isNodeJS = modules[4];
|
||||
|
||||
// Set network stream class for unit tests.
|
||||
if (isNodeJS()) {
|
||||
throw new Error('The `gulp unittest` command cannot be used in ' +
|
||||
'Node.js environments.');
|
||||
}
|
||||
// Set the network stream factory for unit-tests.
|
||||
if (typeof Response !== 'undefined' && 'body' in Response.prototype &&
|
||||
typeof ReadableStream !== 'undefined') {
|
||||
displayApi.setPDFNetworkStreamFactory(function(params) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue