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.
Files changed (65) hide show
  1. package/.eslintrc.json +4 -5
  2. package/README.md +73 -68
  3. package/examples/custom/myFilter.js +2 -2
  4. package/examples/custom/package-lock.json +1012 -77
  5. package/examples/custom/package.json +1 -1
  6. package/examples/custom/snapshot.js +8 -10
  7. package/examples/debug-phantomjs/package-lock.json +76 -76
  8. package/examples/debug-phantomjs/package.json +1 -1
  9. package/examples/debug-phantomjs/snapshot.js +12 -14
  10. package/examples/html5rocks/package-lock.json +1379 -78
  11. package/examples/html5rocks/package.json +1 -1
  12. package/examples/html5rocks/snapshot.js +15 -18
  13. package/examples/process-limit/package-lock.json +1379 -78
  14. package/examples/process-limit/package.json +1 -1
  15. package/examples/process-limit/snapshot.js +8 -10
  16. package/examples/simple-promise/package-lock.json +1379 -78
  17. package/examples/simple-promise/package.json +1 -1
  18. package/examples/simple-promise/snapshot.js +6 -8
  19. package/examples/sitemap-index/package-lock.json +1378 -77
  20. package/examples/sitemap-index/package.json +1 -1
  21. package/examples/sitemap-index/snapshot.js +6 -6
  22. package/examples/utils/index.js +2 -4
  23. package/examples/verbose/package-lock.json +1380 -78
  24. package/examples/verbose/package.json +1 -1
  25. package/examples/verbose/snapshot.js +11 -14
  26. package/lib/async/index.js +0 -1
  27. package/lib/common/index.js +1 -1
  28. package/lib/common/sitemap/index.js +16 -0
  29. package/lib/common/sitemap/sitemap-collection.js +94 -0
  30. package/lib/common/sitemap/sitemap-index.js +68 -0
  31. package/lib/common/{sitemap.js → sitemap/sitemap.js} +68 -57
  32. package/lib/html-snapshots.js +0 -1
  33. package/lib/input-generators/array.js +0 -1
  34. package/lib/input-generators/robots.js +98 -58
  35. package/lib/input-generators/sitemap-index.js +3 -124
  36. package/lib/input-generators/sitemap.js +3 -7
  37. package/lib/input-generators/textfile.js +2 -6
  38. package/package.json +6 -6
  39. package/test/helpers/options.js +4 -2
  40. package/test/mocha/html-snapshots/process-limit.js +46 -48
  41. package/test/mocha/html-snapshots/robots.js +156 -138
  42. package/test/mocha/html-snapshots/server/test_robots.txt +13 -0
  43. package/test/mocha/html-snapshots/server/test_robots_sitemap.txt +15 -0
  44. package/test/mocha/html-snapshots/server/test_robots_sitemap.xml +22 -0
  45. package/test/mocha/html-snapshots/sitemap-index.js +58 -57
  46. package/test/mocha/html-snapshots/snapshot-scripts.js +55 -54
  47. package/test/mocha/html-snapshots/test.js +16 -16
  48. package/test/mocha/html-snapshots/test_robots.txt +0 -2
  49. package/test/mocha/html-snapshots/utils.js +0 -1
  50. package/test/mocha/input-generators/server/test_robots.txt +0 -2
  51. package/test/mocha/input-generators/server/test_robots_bad.txt +0 -2
  52. package/test/mocha/input-generators/server/test_robots_sitemap.txt +17 -0
  53. package/test/mocha/input-generators/server/test_robots_sitemap_bad.txt +17 -0
  54. package/test/mocha/input-generators/server/test_robots_sitemap_multi.txt +18 -0
  55. package/test/mocha/input-generators/server/test_sitemap_index_empty.xml +3 -0
  56. package/test/mocha/input-generators/server/test_sitemap_index_malformed.xml +2 -0
  57. package/test/mocha/input-generators/sitemap-index.js +65 -9
  58. package/test/mocha/input-generators/test.js +276 -280
  59. package/test/mocha/input-generators/test_robots.txt +0 -2
  60. package/test/mocha/input-generators/test_robots_bad.txt +0 -2
  61. package/test/mocha/input-generators/test_robots_sitemap.txt +17 -0
  62. package/test/mocha/input-generators/test_robots_sitemap_bad.txt +17 -0
  63. package/test/mocha/input-generators/test_robots_sitemap_multi.txt +18 -0
  64. package/lib/common/node.js +0 -26
  65. package/test/mocha/common/node.js +0 -100
@@ -7,6 +7,6 @@
7
7
  "start": "node ./snapshot.js"
8
8
  },
9
9
  "dependencies": {
10
- "html-snapshots": "^0.18.1"
10
+ "html-snapshots": "^0.19.0"
11
11
  }
12
12
  }
@@ -4,13 +4,13 @@
4
4
  *
5
5
  * Use array input to snapshot individual pages.
6
6
  */
7
- var htmlSnapshots = require("html-snapshots");
7
+ const htmlSnapshots = require("html-snapshots");
8
8
 
9
9
  // where the snapshots go
10
- var outputDir = require("path").join(__dirname, "./tmp");
10
+ const outputDir = require("path").join(__dirname, "./tmp");
11
11
 
12
12
  // The urls to snapshot, along with the selector to wait for (for each):
13
- var pages = {
13
+ const pages = {
14
14
  "https://google.com": "body",
15
15
  "https://google.com/books": "#oc-search-description"
16
16
  };
@@ -19,14 +19,12 @@ var pages = {
19
19
  htmlSnapshots.run({
20
20
  input: "array",
21
21
  source: Object.keys(pages),
22
- outputDir: outputDir,
22
+ outputDir,
23
23
  outputDirClean: true,
24
24
  selector: pages
25
25
  })
26
- .then(function (completed) {
26
+ .then(completed => {
27
27
  console.log("completed snapshots:");
28
28
  console.log(require("util").inspect(completed));
29
29
  })
30
- .catch(function (err) {
31
- console.error(err);
32
- });
30
+ .catch(console.error);