hounds v1.7.0
hounds
Release the hounds and smoke test any site. Sanity check after a large refactor, or plug into your CI tool of choice.

The beasts will follow all links (internal or otherwise) and round up any uncaught page errors. As a seamless unit, they will scour the field for their quarry by spanning out, containing an area, and expanding (breadth-first search).
Uses nightmare to fire up an Electron webkit browser (with optional UI).
Usage
npm i hounds
const hounds = require('hounds')
const hunt = hounds.release({ url: 'http://localhost:8080' })
.on('error', console.error)
.on('end', process.exit)
const quarry = new Writable({
objectMode: true,
write: (chunk, enc, next) => {
console.dir(chunk)
next()
}
})
hunt.pipe(quarry)To use the built-in stdout writers, you can use hounds.writers.error and hounds.writers.url:
const hunt = hounds.release({
url: 'http://localhost:8080',
logTo: hounds.writers.url()
})
hunt.pipe(hounds.writers.error())To show the Electron UI, with devTools open, and keep both alive, use the following options when releasing the hounds:
{
url: '...',
keepAlive: true,
nightmare: {
show: true, openDevTools: true
}
}Options
urlbase URL to start fromkeepAlivedon't end the stream or the nightmare session when complete (when combined withnightmare.show, allows you to interact with the browser when done).waitAfterLoadedForThe number of milliseconds to wait after each page is loaded before following the next link in the queuemaxFollowsThe maximum number of links to follow and track (the default isInfinity)timeoutThe number of ms before ending the session. When the timeout is reached, the system will end on the next attempt to read from the queue (Note: this has no use whenkeepAliveistrue). (No default)logToAn optional writable stream that all URLs attempting to be processed will be written to.urlFilterAn optional predicate function, taking the currenturlas a parameter, and returningtrueorfalseas to whether or not to include it in the hunt. Second argument ofdomainFilteredis a bool stating whether or not the host matches (use it if you'd like to include that check in your filter)beforeandaftercallbacks receive nightmare instance and if defined, must return it (see examples/preAuth.js)screnshotA function that given the currenturl, returns the path string of the PNG to saveconsoleLevelA string corresponding to one of the console logging levels. The default iserror. In this way, console events that are not Javascript errors can be reported.nightmareAll nightmare 3.0.1 options are supported
Known Issues
screenshotwith outside domains causes nightmare to hang periodically (ref issue on nightmare)console.errorsnot currently handled404s are not currently handled/index.htmland/are not treated as the same URL, and are both processed- Subdomains (including
www) are treated as different hosts unpipe()won't stop the stream from finding results- links which are hidden in the page are still detected, could use jQuery's approach as an optional workaround
Examples
npm i hounds
cd node_modules/hounds/examples
npm iThen try out node . for a basic example based on the test fixtures

Unleash them on the latest sites from HackerNews via node hackerNews
Or use them against a local site with auth (see examples/preAuth.js)

Changelog
0.2.0Supports a single url with a promise0.3.0Stream support (instead of promises)0.3.1Migrated to nightmare - 3x faster than Webdriver/Phantom2 and option to open up devTools0.3.2Stream usage cleanup
0.4.0Support to keep the session alive viakeepAlive0.5.0Handles console errors that occur afterDOMContentLoaded(with configurable timeoutwaitAfterLoadedFor (ms)). Follows links now.0.6.0Prevent visiting the same link twice.0.7.0Allow max number of links to follow or timeout.0.8.0Support for logTo writable stream for URLs processed, and correct error emitting bugfix.0.9.0By default, only links within samehostname:portare considered. Override with predicate functionurlFilter0.10.0urlFilteralso receives result of domain check as second argument. Bug fix: no dupes anchors in the one page1.0.0beforeandaftercallbacks receive nightmare instance and if defined, must return it (see examples/preAuth.js)1.1.0Upgrading to nightmare 2.8.11.2.0Upgrading to nightmare 2.10.01.2.1Fixing tests1.3.0Exposing the writers1.4.0Support forscreenshot1.4.1prettyjsonto regular dependency1.5.0Bugfix:beforeis invoked during the initial run and the system waits until it completes
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago