html-snapshots 0.18.2 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +4 -5
- package/README.md +73 -68
- package/examples/custom/myFilter.js +2 -2
- package/examples/custom/package-lock.json +1012 -77
- package/examples/custom/package.json +1 -1
- package/examples/custom/snapshot.js +8 -10
- package/examples/debug-phantomjs/package-lock.json +76 -76
- package/examples/debug-phantomjs/package.json +1 -1
- package/examples/debug-phantomjs/snapshot.js +12 -14
- package/examples/html5rocks/package-lock.json +1379 -78
- package/examples/html5rocks/package.json +1 -1
- package/examples/html5rocks/snapshot.js +15 -18
- package/examples/process-limit/package-lock.json +1379 -78
- package/examples/process-limit/package.json +1 -1
- package/examples/process-limit/snapshot.js +8 -10
- package/examples/simple-promise/package-lock.json +1379 -78
- package/examples/simple-promise/package.json +1 -1
- package/examples/simple-promise/snapshot.js +6 -8
- package/examples/sitemap-index/package-lock.json +1378 -77
- package/examples/sitemap-index/package.json +1 -1
- package/examples/sitemap-index/snapshot.js +6 -6
- package/examples/utils/index.js +2 -4
- package/examples/verbose/package-lock.json +1380 -78
- package/examples/verbose/package.json +1 -1
- package/examples/verbose/snapshot.js +11 -14
- package/lib/async/index.js +0 -1
- package/lib/common/index.js +1 -1
- package/lib/common/sitemap/index.js +16 -0
- package/lib/common/sitemap/sitemap-collection.js +94 -0
- package/lib/common/sitemap/sitemap-index.js +68 -0
- package/lib/common/{sitemap.js → sitemap/sitemap.js} +68 -57
- package/lib/html-snapshots.js +0 -1
- package/lib/input-generators/array.js +0 -1
- package/lib/input-generators/robots.js +98 -58
- package/lib/input-generators/sitemap-index.js +3 -124
- package/lib/input-generators/sitemap.js +3 -7
- package/lib/input-generators/textfile.js +2 -6
- package/package.json +6 -6
- package/test/helpers/options.js +4 -2
- package/test/mocha/html-snapshots/process-limit.js +46 -48
- package/test/mocha/html-snapshots/robots.js +156 -138
- package/test/mocha/html-snapshots/server/test_robots.txt +13 -0
- package/test/mocha/html-snapshots/server/test_robots_sitemap.txt +15 -0
- package/test/mocha/html-snapshots/server/test_robots_sitemap.xml +22 -0
- package/test/mocha/html-snapshots/sitemap-index.js +58 -57
- package/test/mocha/html-snapshots/snapshot-scripts.js +55 -54
- package/test/mocha/html-snapshots/test.js +16 -16
- package/test/mocha/html-snapshots/test_robots.txt +0 -2
- package/test/mocha/html-snapshots/utils.js +0 -1
- package/test/mocha/input-generators/server/test_robots.txt +0 -2
- package/test/mocha/input-generators/server/test_robots_bad.txt +0 -2
- package/test/mocha/input-generators/server/test_robots_sitemap.txt +17 -0
- package/test/mocha/input-generators/server/test_robots_sitemap_bad.txt +17 -0
- package/test/mocha/input-generators/server/test_robots_sitemap_multi.txt +18 -0
- package/test/mocha/input-generators/server/test_sitemap_index_empty.xml +3 -0
- package/test/mocha/input-generators/server/test_sitemap_index_malformed.xml +2 -0
- package/test/mocha/input-generators/sitemap-index.js +65 -9
- package/test/mocha/input-generators/test.js +276 -280
- package/test/mocha/input-generators/test_robots.txt +0 -2
- package/test/mocha/input-generators/test_robots_bad.txt +0 -2
- package/test/mocha/input-generators/test_robots_sitemap.txt +17 -0
- package/test/mocha/input-generators/test_robots_sitemap_bad.txt +17 -0
- package/test/mocha/input-generators/test_robots_sitemap_multi.txt +18 -0
- package/lib/common/node.js +0 -26
- package/test/mocha/common/node.js +0 -100
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Use sitemap index to drive input to snapshot individual pages.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const htmlSnapshots = require('html-snapshots');
|
|
8
|
+
const utils = require("../utils");
|
|
9
9
|
|
|
10
10
|
// where the snapshots go
|
|
11
|
-
|
|
11
|
+
const outputDir = require('path').join(__dirname, './tmp');
|
|
12
12
|
|
|
13
13
|
// If you want to crawl a huge map:
|
|
14
14
|
// 'https://www.usgs.gov/sitemap.xml',
|
|
@@ -17,17 +17,17 @@ var outputDir = require('path').join(__dirname, './tmp');
|
|
|
17
17
|
htmlSnapshots.run({
|
|
18
18
|
input: 'sitemap-index',
|
|
19
19
|
source: 'http://bestplacestowork.org/sitemap_index.xml',
|
|
20
|
-
outputDir
|
|
20
|
+
outputDir,
|
|
21
21
|
outputDirClean: true,
|
|
22
22
|
selector: 'body',
|
|
23
23
|
timeout: 60000
|
|
24
24
|
})
|
|
25
|
-
.then(
|
|
25
|
+
.then(completed => {
|
|
26
26
|
console.log('completed #', completed.length);
|
|
27
27
|
console.log('completed snapshots:');
|
|
28
28
|
console.log(require('util').inspect(completed));
|
|
29
29
|
})
|
|
30
|
-
.catch(
|
|
30
|
+
.catch(err => {
|
|
31
31
|
console.error('completed #', err.completed.length);
|
|
32
32
|
console.error('not completed #', err.notCompleted.length)
|
|
33
33
|
console.error(err);
|
package/examples/utils/index.js
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
* Utilities for the examples.
|
|
3
3
|
* Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var spawn = require('child_process').spawn;
|
|
5
|
+
const spawn = require('child_process').spawn;
|
|
8
6
|
|
|
9
7
|
function cleanupAndExit (failure) {
|
|
10
8
|
var pkill;
|
|
@@ -23,5 +21,5 @@ function cleanupAndExit (failure) {
|
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
module.exports = {
|
|
26
|
-
cleanupAndExit
|
|
24
|
+
cleanupAndExit
|
|
27
25
|
};
|