Open brunofiorentino opened 8 years ago
Do you have node 4.x
? It's currently unsupported.
All unit tests pass with request 2.62.0
(without node 4.x
).
I'm not using node 4.0. I'm running node 0.12.7, installed via nvm and tried on booth OSX 10.10 and Ubuntu 15.04. That's my OSX terminal running the hacker news dynamic scraper sample with requests 2.62:
brunao-ux1:scrapers brunao$ node -v
v0.12.7
brunao-ux1:scrapers brunao$ cat hn-sample.js
var scraperjs = require('scraperjs');
scraperjs.DynamicScraper.create('https://news.ycombinator.com/')
.scrape(function() {
return $(".title a").map(function() {
return $(this).text();
}).get();
}, function(news) {
console.log(news);
})
brunao-ux1:scrapers brunao$ node hn-sample.js
stream.js:94
throw er; // Unhandled stream error in pipe.
^
Error
at Object.<anonymous> (/Users/brunao/cdng/f7e/pecaspara/scrapers/node_modules/scraperjs/src/ScraperError.js:32:26)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/brunao/cdng/f7e/pecaspara/scrapers/node_modules/scraperjs/src/DynamicScraper.js:5:17)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
Also, some dynamicScraper related tests failed on booth OSX and Ubuntu too:
[4mRunning "clean:coverage" (clean) task[24m
[32m>> [39m1 path cleaned.
[4mRunning "jshint:all" (jshint) task[24m
[32m>> [39m16 files lint free.
[4mRunning "serve" task[24m
Listening on port 3000
[4mRunning "exec:coverage" (exec) task[24m
[0m[0m
[32m ✓[0m[90m ScraperError [0m
[0m AbstractScraper[0m
[32m ✓[0m[90m get [0m
[32m ✓[0m[90m request [0m
[32m ✓[0m[90m getStatusCode [0m
[32m ✓[0m[90m getResponse [0m
[32m ✓[0m[90m getBody [0m
[32m ✓[0m[90m loadBody [0m
[32m ✓[0m[90m scrape [0m
[32m ✓[0m[90m close [0m
[32m ✓[0m[90m clone [0m
[0m DynamicScraper[0m
[32m ✓[0m[90m .loadBody, .scrape, .close [0m[31m(1127ms)[0m
[32m ✓[0m[90m .clone [0m
[32m ✓[0m[90m #startFactory, #closeFactory [0m
[0m #create[0m
[32m ✓[0m[90m with argument [0m[31m(1275ms)[0m
[32m ✓[0m[90m without argument [0m[31m(1094ms)[0m
[0m .inject[0m
[32m ✓[0m[90m page not loaded [0m
[32m ✓[0m[90m success [0m[31m(1092ms)[0m
[32m ✓[0m[90m fails [0m[31m(1087ms)[0m
[32m ✓[0m[90m fails jQuery [0m[31m(1073ms)[0m
[0m Router[0m
[32m ✓[0m[90m get [0m
[32m ✓[0m[90m request [0m
[32m ✓[0m[90m otherwise [0m
[32m ✓[0m[90m route [0m
[32m ✓[0m[90m createStatic [0m
[32m ✓[0m[90m createDynamic [0m[31m(1199ms)[0m
[32m ✓[0m[90m use [0m
[32m ✓[0m[90m usage of params [0m
[0m #pathMatcher[0m
[32m ✓[0m[90m with string [0m
[32m ✓[0m[90m with regular expression [0m
[0m on[0m
[32m ✓[0m[90m with path [0m
[32m ✓[0m[90m with function [0m
[0m instantiation[0m
[32m ✓[0m[90m with firstMatch [0m
[32m ✓[0m[90m without firstMatch [0m
[0m bad formatting[0m
[32m ✓[0m[90m get [0m
[32m ✓[0m[90m request [0m
[32m ✓[0m[90m createStatic [0m
[32m ✓[0m[90m createDynamic [0m
[32m ✓[0m[90m use [0m
[0m Scraper Promise[0m
[0m with StaticScraper[0m
[32m ✓[0m[90m timeout [0m[31m(109ms)[0m
[32m ✓[0m[90m then [0m
[32m ✓[0m[90m then [0m
[32m ✓[0m[90m onError [0m
[32m ✓[0m[90m error without onError [0m
[32m ✓[0m[90m delay [0m[31m(109ms)[0m
[32m ✓[0m[90m request [0m
[32m ✓[0m[90m done [0m
[32m ✓[0m[90m _setChainParameter [0m
[32m ✓[0m[90m _setPromises [0m
[32m ✓[0m[90m clone [0m
[32m ✓[0m[90m passing values between promises [0m
[0m onStatusCode[0m
[32m ✓[0m[90m with code [0m
[32m ✓[0m[90m without code [0m
[0m scrape[0m
[32m ✓[0m[90m without extra arguments [0m
[32m ✓[0m[90m without extra arguments [0m
[32m ✓[0m[90m with only the scraping function [0m
[32m ✓[0m[90m with error [0m
[0m _fire[0m
[32m ✓[0m[90m without error [0m
[32m ✓[0m[90m with error [0m
[0m usage of utils[0m
[32m ✓[0m[90m stop() [0m
[32m ✓[0m[90m scraper [0m
[32m ✓[0m[90m params [0m
[0m with DynamicScraper[0m
[0m with Factory[0m
[32m ✓[0m[90m timeout [0m[31m(1176ms)[0m
[32m ✓[0m[90m then [0m[31m(1086ms)[0m
[32m ✓[0m[90m then [0m[31m(1078ms)[0m
[32m ✓[0m[90m onError [0m[31m(1093ms)[0m
[32m ✓[0m[90m delay [0m[31m(1201ms)[0m
[32m ✓[0m[90m request [0m[31m(1080ms)[0m
[32m ✓[0m[90m done [0m[31m(1195ms)[0m
[32m ✓[0m[90m _setChainParameter [0m
[32m ✓[0m[90m _setPromises [0m
[32m ✓[0m[90m clone [0m
[32m ✓[0m[90m passing values between promises [0m[31m(1745ms)[0m
[0m onStatusCode[0m
[32m ✓[0m[90m with code [0m[31m(1081ms)[0m
[32m ✓[0m[90m without code [0m[31m(1086ms)[0m
[0m scrape[0m
[31m 1) without extra arguments[0m
[31m 2) without extra arguments[0m
[31m 3) with only the scraping function[0m
[32m ✓[0m[90m with error [0m[31m(1089ms)[0m
[0m _fire[0m
[32m ✓[0m[90m without error [0m
[32m ✓[0m[90m with error [0m
[0m usage of utils[0m
[32m ✓[0m[90m stop() [0m[31m(1600ms)[0m
[32m ✓[0m[90m scraper [0m[31m(1087ms)[0m
[32m ✓[0m[90m params [0m[31m(1083ms)[0m
[0m without Factory[0m
[32m ✓[0m[90m timeout [0m[31m(1189ms)[0m
[32m ✓[0m[90m then [0m[31m(1080ms)[0m
[32m ✓[0m[90m then [0m[31m(1091ms)[0m
[32m ✓[0m[90m onError [0m[31m(1085ms)[0m
[32m ✓[0m[90m delay [0m[31m(1188ms)[0m
[32m ✓[0m[90m request [0m[31m(1082ms)[0m
[32m ✓[0m[90m done [0m[31m(1083ms)[0m
[32m ✓[0m[90m _setChainParameter [0m
[32m ✓[0m[90m _setPromises [0m
[32m ✓[0m[90m clone [0m
[32m ✓[0m[90m passing values between promises [0m[31m(1116ms)[0m
[0m onStatusCode[0m
[32m ✓[0m[90m with code [0m[31m(1185ms)[0m
[32m ✓[0m[90m without code [0m[31m(1204ms)[0m
[0m scrape[0m
[32m ✓[0m[90m without extra arguments [0m[31m(1299ms)[0m
[31m 4) without extra arguments[0m
[32m ✓[0m[90m with only the scraping function [0m[31m(1162ms)[0m
[32m ✓[0m[90m with error [0m[31m(1169ms)[0m
[0m _fire[0m
[32m ✓[0m[90m without error [0m
[32m ✓[0m[90m with error [0m
[0m usage of utils[0m
[32m ✓[0m[90m stop() [0m[31m(1259ms)[0m
[32m ✓[0m[90m scraper [0m[31m(1193ms)[0m
[32m ✓[0m[90m params [0m[31m(1501ms)[0m
[0m StaticScraper[0m
[32m ✓[0m[90m .clone [0m
[0m #create[0m
[32m ✓[0m[90m with argument [0m
[32m ✓[0m[90m without argument [0m
[0m .loadBody, .scrape, .close[0m
[32m ✓[0m[90m without errors [0m
[32m ✓[0m[90m with errors [0m
[92m [0m[32m 106 passing[0m[90m (49s)[0m
[31m>> [39m[31m 4 failing[0m
[31m>> [39m
[31m>> [39m[0m 1) Scraper Promise with DynamicScraper with Factory scrape without extra arguments:[31m
>> [39m[0m[31m Uncaught AssertionError: 10 == 9[0m[90m[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/test/ScraperPromise.js:130:12[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/src/ScraperPromise.js:9:2689[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/src/DynamicScraper.js:9:2390[31m
>> [39m at Proto.apply (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/index.js:123:13)[31m
>> [39m at Proto.handle (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/index.js:99:19)[31m
>> [39m at D.dnode.handle (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/lib/dnode.js:140:21)[31m
>> [39m at D.dnode.write (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/lib/dnode.js:128:22)[31m
>> [39m at SockJSConnection.ondata (stream.js:51:26)[31m
>> [39m at SockJSConnection.emit (events.js:107:17)[31m
>> [39m at Session.didMessage (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/lib/transport.js:220:25)[31m
>> [39m at WebSocketReceiver.didMessage (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/lib/trans-websocket.js:102:40)[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/lib/trans-websocket.js:75:22[31m
>> [39m at null.<anonymous> (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js:41:7)[31m
>> [39m at Array.forEach (native)[31m
>> [39m at EventTarget.dispatchEvent (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js:40:33)[31m
>> [39m at API.receive (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/api.js:30:10)[31m
>> [39m at instance.parse (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/draft75_parser.js:56:26)[31m
>> [39m at Draft76Parser.parse (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/draft76_parser.js:77:42)[31m
>> [39m at Socket.<anonymous> (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket.js:72:33)[31m
>> [39m at Socket.emit (events.js:107:17)[31m
>> [39m at readableAddChunk (_stream_readable.js:163:16)[31m
>> [39m at Socket.Readable.push (_stream_readable.js:126:10)[31m
>> [39m at TCP.onread (net.js:538:20)[31m
>> [39m[0m
[31m>> [39m[0m 2) Scraper Promise with DynamicScraper with Factory scrape without extra arguments:[31m
>> [39m[0m[31m Uncaught AssertionError: 10 == 9[0m[90m[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/test/ScraperPromise.js:154:12[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/src/ScraperPromise.js:9:2689[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/src/DynamicScraper.js:9:2390[31m
>> [39m at Proto.apply (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/index.js:123:13)[31m
>> [39m at Proto.handle (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/index.js:99:19)[31m
>> [39m at D.dnode.handle (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/lib/dnode.js:140:21)[31m
>> [39m at D.dnode.write (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/lib/dnode.js:128:22)[31m
>> [39m at SockJSConnection.ondata (stream.js:51:26)[31m
>> [39m at SockJSConnection.emit (events.js:107:17)[31m
>> [39m at Session.didMessage (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/lib/transport.js:220:25)[31m
>> [39m at WebSocketReceiver.didMessage (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/lib/trans-websocket.js:102:40)[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/lib/trans-websocket.js:75:22[31m
>> [39m at null.<anonymous> (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js:41:7)[31m
>> [39m at Array.forEach (native)[31m
>> [39m at EventTarget.dispatchEvent (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js:40:33)[31m
>> [39m at API.receive (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/api.js:30:10)[31m
>> [39m at instance.parse (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/draft75_parser.js:56:26)[31m
>> [39m at Draft76Parser.parse (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/draft76_parser.js:77:42)[31m
>> [39m at Socket.<anonymous> (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket.js:72:33)[31m
>> [39m at Socket.emit (events.js:107:17)[31m
>> [39m at readableAddChunk (_stream_readable.js:163:16)[31m
>> [39m at Socket.Readable.push (_stream_readable.js:126:10)[31m
>> [39m at TCP.onread (net.js:538:20)[31m
>> [39m[0m
[31m>> [39m[0m 3) Scraper Promise with DynamicScraper with Factory scrape with only the scraping function:[31m
>> [39m[0m[31m Uncaught AssertionError: 10 == 9[0m[90m[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/test/ScraperPromise.js:180:12[31m
>> [39m at then (/Users/brunao/cdng/f7e/scraperjs/src/ScraperPromise.js:9:4281)[31m
>> [39m at dispatcher (/Users/brunao/cdng/f7e/scraperjs/src/ScraperPromise.js:9:7483)[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/node_modules/async/lib/async.js:187:20[31m
>> [39m at iterate (/Users/brunao/cdng/f7e/scraperjs/node_modules/async/lib/async.js:265:13)[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/node_modules/async/lib/async.js:277:29[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/node_modules/async/lib/async.js:44:16[31m
>> [39m at done (/Users/brunao/cdng/f7e/scraperjs/src/ScraperPromise.js:9:7171)[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/src/ScraperPromise.js:9:2684[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/src/DynamicScraper.js:9:2390[31m
>> [39m at Proto.apply (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/index.js:123:13)[31m
>> [39m at Proto.handle (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/index.js:99:19)[31m
>> [39m at D.dnode.handle (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/lib/dnode.js:140:21)[31m
>> [39m at D.dnode.write (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/lib/dnode.js:128:22)[31m
>> [39m at SockJSConnection.ondata (stream.js:51:26)[31m
>> [39m at SockJSConnection.emit (events.js:107:17)[31m
>> [39m at Session.didMessage (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/lib/transport.js:220:25)[31m
>> [39m at WebSocketReceiver.didMessage (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/lib/trans-websocket.js:102:40)[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/lib/trans-websocket.js:75:22[31m
>> [39m at null.<anonymous> (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js:41:7)[31m
>> [39m at Array.forEach (native)[31m
>> [39m at EventTarget.dispatchEvent (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js:40:33)[31m
>> [39m at API.receive (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/api.js:30:10)[31m
>> [39m at instance.parse (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/draft75_parser.js:56:26)[31m
>> [39m at Draft76Parser.parse (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/draft76_parser.js:77:42)[31m
>> [39m at Socket.<anonymous> (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket.js:72:33)[31m
>> [39m at Socket.emit (events.js:107:17)[31m
>> [39m at readableAddChunk (_stream_readable.js:163:16)[31m
>> [39m at Socket.Readable.push (_stream_readable.js:126:10)[31m
>> [39m at TCP.onread (net.js:538:20)[31m
>> [39m[0m
[31m>> [39m[0m 4) Scraper Promise with DynamicScraper without Factory scrape without extra arguments:[31m
>> [39m[0m[31m Uncaught AssertionError: 10 == 9[0m[90m[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/test/ScraperPromise.js:154:12[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/src/ScraperPromise.js:9:2689[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/src/DynamicScraper.js:9:2390[31m
>> [39m at Proto.apply (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/index.js:123:13)[31m
>> [39m at Proto.handle (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/index.js:99:19)[31m
>> [39m at D.dnode.handle (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/lib/dnode.js:140:21)[31m
>> [39m at D.dnode.write (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/dnode/lib/dnode.js:128:22)[31m
>> [39m at SockJSConnection.ondata (stream.js:51:26)[31m
>> [39m at SockJSConnection.emit (events.js:107:17)[31m
>> [39m at Session.didMessage (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/lib/transport.js:220:25)[31m
>> [39m at WebSocketReceiver.didMessage (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/lib/trans-websocket.js:102:40)[31m
>> [39m at /Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/lib/trans-websocket.js:75:22[31m
>> [39m at null.<anonymous> (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js:41:7)[31m
>> [39m at Array.forEach (native)[31m
>> [39m at EventTarget.dispatchEvent (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js:40:33)[31m
>> [39m at API.receive (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/api.js:30:10)[31m
>> [39m at instance.parse (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/draft75_parser.js:56:26)[31m
>> [39m at Draft76Parser.parse (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket/draft76_parser.js:77:42)[31m
>> [39m at Socket.<anonymous> (/Users/brunao/cdng/f7e/scraperjs/node_modules/phantom/node_modules/shoe/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket.js:72:33)[31m
>> [39m at Socket.emit (events.js:107:17)[31m
>> [39m at readableAddChunk (_stream_readable.js:163:16)[31m
>> [39m at Socket.Readable.push (_stream_readable.js:126:10)[31m
>> [39m at TCP.onread (net.js:538:20)[31m
>> [39m[0m[31m
>> [39m[31m
>> [39m=============================================================================[31m
>> [39mWriting coverage object [/Users/brunao/cdng/f7e/scraperjs/coverage/coverage.json]
[31m>> [39mWriting coverage reports at [/Users/brunao/cdng/f7e/scraperjs/coverage][31m
>> [39m=============================================================================
=============================== Coverage summary ===============================
Statements : 99.7% ( 333/334 )
Branches : 100% ( 111/111 )
Functions : 98.15% ( 106/108 )
Lines : 100% ( 333/333 )
================================================================================
[31m>> [39mExited with code: 4.
[33mWarning: Task "exec:coverage" failed. Use --force to continue.[39m
[31mAborted due to warnings.[39m
I'm also running node v0.12.7
on OSX 10.10.
Try to download and install a fresh copy of scraperjs
and check if the installation is error free.
That's what I've done. In the application directory I removed ./node_modules and ran npm install
several times (including the root dir) while trying to make things work. And to obtain the test output above: I "git cloned" scraperjs
in another directory and then ran grunt test
.
Considering our systems are equal, do you think some global state (node or system wide) might compromise the library? Phanthom, for instance, must be installed with npm install -g
.
Updating requests module from 2.61 to 2.62 (allowed by semver) breaks DynamicScraper with 'Unhandled stream error in pipe.' error message. Besides by application code it breaks the simpler DynamicScraper Hacker News sample too.
In order to obtain an older and working module tree I tried 'npm shrinkwrap' at first, but it thrown an error about phantomjs inner dependencies, so I removed ./node_modules/scraperjs/node_modules/, pinned requests@2.61.0 in ./node_modules/scraperjs/package.json and ran npm install inside it. DynamicScraper started working again.