Skip to content

Instantly share code, notes, and snippets.

@sbma44
Created September 15, 2014 21:11
Show Gist options
  • Save sbma44/c2fb2ac61196ce59fe8a to your computer and use it in GitHub Desktop.
Save sbma44/c2fb2ac61196ce59fe8a to your computer and use it in GitHub Desktop.
$ npm test
> pdf-extract@1.0.7 test /Users/tomlee/Dropbox (MapBox)/code/js/ogp/node_modules/pdf-extract
> mocha --reporter spec
01 Command Test
✓ should have ghostscript (gs) binary on path
✓ should have pdftotext binary on path
✓ should have tesseract binary on path
02 Split Test
✓ should split multi-page pdf in single page pdf files
✓ should split single page pdf into a new single page pdf files
03 Searchable Test
✓ should return an error when not passing a type for a searchable pdf
✓ should extract text from electronic searchable pdf
04 Multipage searchable test
✓ should extract array of text pages from multipage searchable pdf
05 Convert Test
✓ should convert raw single page pdf to tif file
06 OCR Test
1) should extract text from tif file via tesseract ocr
2) should ocr tif file using custom language file
07 Multipage raw test
◦ should extract array of text pages from multipage raw scan pdf:
Please be patient, this test make take a minute or more to complete
log data: 'finished splitting pages for file at path /Users/tomlee/Dropbox (MapBox)/code/js/ogp/node_modules/pdf-extract/test/test_data/multipage_raw.pdf'
log data: 'converted page to intermediate tiff file, page 0 (0-based indexing) of 1'
3) should extract array of text pages from multipage raw scan pdf
◦ should ocr raw scan using custom language in ocr_flags: 'Please be patient, this test make take a minute or more to complete'
log event: 'finished splitting pages for file at path /Users/tomlee/Dropbox (MapBox)/code/js/ogp/node_modules/pdf-extract/test/test_data/multipage_raw.pdf'
log event: 'converted page to intermediate tiff file, page 0 (0-based indexing) of 1'
4) should ocr raw scan using custom language in ocr_flags
✖ 4 of 13 tests failed:
1) 06 OCR Test should extract text from tif file via tesseract ocr:
AssertionError: expected { [Error: Command failed: dyld: Library not loaded: /usr/local/lib/libjpeg.8.dylib
Referenced from: /usr/local/lib/liblept.4.dylib
Reason: image not found
] killed: false, code: null, signal: 'SIGTRAP' } to not exist
at /Users/tomlee/Dropbox (MapBox)/code/js/ogp/node_modules/pdf-extract/test/06_ocr-test.js:18:20
at /Users/tomlee/Dropbox (MapBox)/code/js/ogp/node_modules/pdf-extract/lib/ocr.js:31:25
at ChildProcess.exithandler (child_process.js:652:7)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Socket.<anonymous> (child_process.js:969:11)
at Socket.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
2) 06 OCR Test should ocr tif file using custom language file:
AssertionError: expected { [Error: Command failed: dyld: Library not loaded: /usr/local/lib/libjpeg.8.dylib
Referenced from: /usr/local/lib/liblept.4.dylib
Reason: image not found
] killed: false, code: null, signal: 'SIGTRAP' } to not exist
at /Users/tomlee/Dropbox (MapBox)/code/js/ogp/node_modules/pdf-extract/test/06_ocr-test.js:40:20
at /Users/tomlee/Dropbox (MapBox)/code/js/ogp/node_modules/pdf-extract/lib/ocr.js:31:25
at ChildProcess.exithandler (child_process.js:652:7)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Socket.<anonymous> (child_process.js:969:11)
at Socket.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
3) 07 Multipage raw test should extract array of text pages from multipage raw scan pdf:
Error: Command failed: dyld: Library not loaded: /usr/local/lib/libtiff.5.dylib
Referenced from: /usr/local/bin/gs
Reason: image not found
at ChildProcess.exithandler (child_process.js:648:15)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Socket.<anonymous> (child_process.js:969:11)
at Socket.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
4) 07 Multipage raw test should ocr raw scan using custom language in ocr_flags:
AssertionError: expected { [Error: Command failed: dyld: Library not loaded: /usr/local/lib/libtiff.5.dylib
Referenced from: /usr/local/bin/gs
Reason: image not found
] killed: false, code: null, signal: 'SIGTRAP' } to not exist
at Raw.<anonymous> (/Users/tomlee/Dropbox (MapBox)/code/js/ogp/node_modules/pdf-extract/test/07_raw-test.js:100:18)
at Raw.emit (events.js:95:17)
at /Users/tomlee/Dropbox (MapBox)/code/js/ogp/node_modules/pdf-extract/lib/raw.js:116:20
at /Users/tomlee/Dropbox (MapBox)/code/js/ogp/node_modules/pdf-extract/node_modules/async/lib/async.js:110:21
at /Users/tomlee/Dropbox (MapBox)/code/js/ogp/node_modules/pdf-extract/lib/raw.js:91:33
at /Users/tomlee/Dropbox (MapBox)/code/js/ogp/node_modules/pdf-extract/lib/convert.js:52:16
at ChildProcess.exithandler (child_process.js:652:7)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Socket.<anonymous> (child_process.js:969:11)
at Socket.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment