html-snapshots 1.1.0 → 1.3.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.
@@ -8,7 +8,7 @@
8
8
  "name": "html-snapshots-example",
9
9
  "version": "0.1.0",
10
10
  "dependencies": {
11
- "html-snapshots": "^1.0.1"
11
+ "html-snapshots": "^1.2.0"
12
12
  }
13
13
  },
14
14
  "node_modules/@sindresorhus/is": {
@@ -39,9 +39,9 @@
39
39
  "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ=="
40
40
  },
41
41
  "node_modules/@types/node": {
42
- "version": "18.7.23",
43
- "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz",
44
- "integrity": "sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg==",
42
+ "version": "18.11.0",
43
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.0.tgz",
44
+ "integrity": "sha512-IOXCvVRToe7e0ny7HpT/X9Rb2RYtElG1a+VshjwT00HxrM2dWBApHQoqsI6WiY7Q03vdf2bCrIGzVrkF/5t10w==",
45
45
  "optional": true
46
46
  },
47
47
  "node_modules/@types/yauzl": {
@@ -397,9 +397,9 @@
397
397
  }
398
398
  },
399
399
  "node_modules/devtools-protocol": {
400
- "version": "0.0.1036444",
401
- "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1036444.tgz",
402
- "integrity": "sha512-0y4f/T8H9lsESV9kKP1HDUXgHxCdniFeJh6Erq+FbdOEvp/Ydp9t8kcAAM5gOd17pMrTDlFWntoHtzzeTUWKNw=="
400
+ "version": "0.0.1045489",
401
+ "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1045489.tgz",
402
+ "integrity": "sha512-D+PTmWulkuQW4D1NTiCRCFxF7pQPn0hgp4YyX4wAQ6xYXKOadSWPR3ENGDQ47MW/Ewc9v2rpC/UEEGahgBYpSQ=="
403
403
  },
404
404
  "node_modules/ecc-jsbn": {
405
405
  "version": "0.1.2",
@@ -501,9 +501,9 @@
501
501
  }
502
502
  },
503
503
  "node_modules/form-data-encoder": {
504
- "version": "2.1.2",
505
- "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-2.1.2.tgz",
506
- "integrity": "sha512-FCaIOVTRA9E0siY6FeXid7D5yrCqpsErplUkE2a1BEiKj1BE9z6FbKB4ntDTwC4NVLie9p+4E9nX4mWwEOT05A==",
504
+ "version": "2.1.3",
505
+ "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-2.1.3.tgz",
506
+ "integrity": "sha512-KqU0nnPMgIJcCOFTNJFEA8epcseEaoox4XZffTgy8jlI6pL/5EFyR54NRG7CnCJN0biY7q52DO3MH6/sJ/TKlQ==",
507
507
  "engines": {
508
508
  "node": ">= 14.17"
509
509
  }
@@ -567,9 +567,9 @@
567
567
  }
568
568
  },
569
569
  "node_modules/got": {
570
- "version": "12.5.1",
571
- "resolved": "https://registry.npmjs.org/got/-/got-12.5.1.tgz",
572
- "integrity": "sha512-sD16AK8cCyUoPtKr/NMvLTFFa+T3i3S+zoiuvhq0HP2YiqBZA9AtlBjAdsQBsLBK7slPuvmfE0OxhGi7N5dD4w==",
570
+ "version": "12.5.2",
571
+ "resolved": "https://registry.npmjs.org/got/-/got-12.5.2.tgz",
572
+ "integrity": "sha512-guHGMSEcsA5m1oPRweXUJnug0vuvlkX9wx5hzOka+ZBrBUOJHU0Z1JcNu3QE5IPGnA5aXUsQHdWOD4eJg9/v3A==",
573
573
  "dependencies": {
574
574
  "@sindresorhus/is": "^5.2.0",
575
575
  "@szmarczak/http-timer": "^5.0.1",
@@ -629,18 +629,18 @@
629
629
  }
630
630
  },
631
631
  "node_modules/html-snapshots": {
632
- "version": "1.0.1",
633
- "resolved": "https://registry.npmjs.org/html-snapshots/-/html-snapshots-1.0.1.tgz",
634
- "integrity": "sha512-BnVQ7pL/ybYWVdoktSHvp1NybZ1UOt3xd5vTQ8agO388hwU63oTqgZV4Xe2nxW0Bb83Xia9/VNiWPGrJ320Uhw==",
632
+ "version": "1.2.0",
633
+ "resolved": "https://registry.npmjs.org/html-snapshots/-/html-snapshots-1.2.0.tgz",
634
+ "integrity": "sha512-/erOUW66PXzxzmq9daIt9F/sOGtLCKIjT7VuFUutNeZCtjiK6eM6bBiF9CFq9SOsyJ1sWqFasBUsq7F9GSnWpA==",
635
635
  "dependencies": {
636
636
  "async": "3.2.4",
637
637
  "async-lock": "1.3.2",
638
638
  "combine-errors": "3.0.3",
639
- "got": "12.5.1",
639
+ "got": "12.5.2",
640
640
  "lodash": "4.17.21",
641
641
  "mkdirp": "1.0.4",
642
642
  "phantomjs-prebuilt": "2.1.16",
643
- "puppeteer": "^18.0.5",
643
+ "puppeteer": "^19.0.0",
644
644
  "rimraf": "3.0.2",
645
645
  "xml2js": "0.4.23"
646
646
  },
@@ -1126,28 +1126,41 @@
1126
1126
  }
1127
1127
  },
1128
1128
  "node_modules/puppeteer": {
1129
- "version": "18.0.5",
1130
- "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-18.0.5.tgz",
1131
- "integrity": "sha512-s4erjxU0VtKojPvF+KvLKG6OHUPw7gO2YV1dtOsoryyCbhrs444fXb4QZqGWuTv3V/rgSCUzeixxu34g0ZkSMA==",
1129
+ "version": "19.0.0",
1130
+ "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-19.0.0.tgz",
1131
+ "integrity": "sha512-3Ga5IVerQQ2hKU9q7T28RmcUsd8F2kL6cYuPcPCzeclSjmHhGydPBZL/KJKC02sG6J6Wfry85uiWpbkjQ5qBiw==",
1132
1132
  "hasInstallScript": true,
1133
+ "dependencies": {
1134
+ "https-proxy-agent": "5.0.1",
1135
+ "progress": "2.0.3",
1136
+ "proxy-from-env": "1.1.0",
1137
+ "puppeteer-core": "19.0.0"
1138
+ },
1139
+ "engines": {
1140
+ "node": ">=14.1.0"
1141
+ }
1142
+ },
1143
+ "node_modules/puppeteer-core": {
1144
+ "version": "19.0.0",
1145
+ "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-19.0.0.tgz",
1146
+ "integrity": "sha512-OljQ9W5M4cBX68vnOAGbcRkVENDHn6lfj6QYoGsnLQsxPAh6ExTQAhHauwdFdQkhYdDExZFWlKArnBONzeHY+g==",
1133
1147
  "dependencies": {
1134
1148
  "cross-fetch": "3.1.5",
1135
1149
  "debug": "4.3.4",
1136
- "devtools-protocol": "0.0.1036444",
1150
+ "devtools-protocol": "0.0.1045489",
1137
1151
  "extract-zip": "2.0.1",
1138
1152
  "https-proxy-agent": "5.0.1",
1139
- "progress": "2.0.3",
1140
1153
  "proxy-from-env": "1.1.0",
1141
1154
  "rimraf": "3.0.2",
1142
1155
  "tar-fs": "2.1.1",
1143
1156
  "unbzip2-stream": "1.4.3",
1144
- "ws": "8.8.1"
1157
+ "ws": "8.9.0"
1145
1158
  },
1146
1159
  "engines": {
1147
1160
  "node": ">=14.1.0"
1148
1161
  }
1149
1162
  },
1150
- "node_modules/puppeteer/node_modules/debug": {
1163
+ "node_modules/puppeteer-core/node_modules/debug": {
1151
1164
  "version": "4.3.4",
1152
1165
  "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
1153
1166
  "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
@@ -1163,7 +1176,7 @@
1163
1176
  }
1164
1177
  }
1165
1178
  },
1166
- "node_modules/puppeteer/node_modules/extract-zip": {
1179
+ "node_modules/puppeteer-core/node_modules/extract-zip": {
1167
1180
  "version": "2.0.1",
1168
1181
  "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
1169
1182
  "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==",
@@ -1182,7 +1195,7 @@
1182
1195
  "@types/yauzl": "^2.9.1"
1183
1196
  }
1184
1197
  },
1185
- "node_modules/puppeteer/node_modules/get-stream": {
1198
+ "node_modules/puppeteer-core/node_modules/get-stream": {
1186
1199
  "version": "5.2.0",
1187
1200
  "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
1188
1201
  "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
@@ -1196,7 +1209,7 @@
1196
1209
  "url": "https://github.com/sponsors/sindresorhus"
1197
1210
  }
1198
1211
  },
1199
- "node_modules/puppeteer/node_modules/ms": {
1212
+ "node_modules/puppeteer-core/node_modules/ms": {
1200
1213
  "version": "2.1.2",
1201
1214
  "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
1202
1215
  "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
@@ -1528,9 +1541,9 @@
1528
1541
  "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
1529
1542
  },
1530
1543
  "node_modules/ws": {
1531
- "version": "8.8.1",
1532
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.1.tgz",
1533
- "integrity": "sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA==",
1544
+ "version": "8.9.0",
1545
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.9.0.tgz",
1546
+ "integrity": "sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg==",
1534
1547
  "engines": {
1535
1548
  "node": ">=10.0.0"
1536
1549
  },
@@ -1597,9 +1610,9 @@
1597
1610
  "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ=="
1598
1611
  },
1599
1612
  "@types/node": {
1600
- "version": "18.7.23",
1601
- "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz",
1602
- "integrity": "sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg==",
1613
+ "version": "18.11.0",
1614
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.0.tgz",
1615
+ "integrity": "sha512-IOXCvVRToe7e0ny7HpT/X9Rb2RYtElG1a+VshjwT00HxrM2dWBApHQoqsI6WiY7Q03vdf2bCrIGzVrkF/5t10w==",
1603
1616
  "optional": true
1604
1617
  },
1605
1618
  "@types/yauzl": {
@@ -1873,9 +1886,9 @@
1873
1886
  "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
1874
1887
  },
1875
1888
  "devtools-protocol": {
1876
- "version": "0.0.1036444",
1877
- "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1036444.tgz",
1878
- "integrity": "sha512-0y4f/T8H9lsESV9kKP1HDUXgHxCdniFeJh6Erq+FbdOEvp/Ydp9t8kcAAM5gOd17pMrTDlFWntoHtzzeTUWKNw=="
1889
+ "version": "0.0.1045489",
1890
+ "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1045489.tgz",
1891
+ "integrity": "sha512-D+PTmWulkuQW4D1NTiCRCFxF7pQPn0hgp4YyX4wAQ6xYXKOadSWPR3ENGDQ47MW/Ewc9v2rpC/UEEGahgBYpSQ=="
1879
1892
  },
1880
1893
  "ecc-jsbn": {
1881
1894
  "version": "0.1.2",
@@ -1964,9 +1977,9 @@
1964
1977
  }
1965
1978
  },
1966
1979
  "form-data-encoder": {
1967
- "version": "2.1.2",
1968
- "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-2.1.2.tgz",
1969
- "integrity": "sha512-FCaIOVTRA9E0siY6FeXid7D5yrCqpsErplUkE2a1BEiKj1BE9z6FbKB4ntDTwC4NVLie9p+4E9nX4mWwEOT05A=="
1980
+ "version": "2.1.3",
1981
+ "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-2.1.3.tgz",
1982
+ "integrity": "sha512-KqU0nnPMgIJcCOFTNJFEA8epcseEaoox4XZffTgy8jlI6pL/5EFyR54NRG7CnCJN0biY7q52DO3MH6/sJ/TKlQ=="
1970
1983
  },
1971
1984
  "fs-constants": {
1972
1985
  "version": "1.0.0",
@@ -2015,9 +2028,9 @@
2015
2028
  }
2016
2029
  },
2017
2030
  "got": {
2018
- "version": "12.5.1",
2019
- "resolved": "https://registry.npmjs.org/got/-/got-12.5.1.tgz",
2020
- "integrity": "sha512-sD16AK8cCyUoPtKr/NMvLTFFa+T3i3S+zoiuvhq0HP2YiqBZA9AtlBjAdsQBsLBK7slPuvmfE0OxhGi7N5dD4w==",
2031
+ "version": "12.5.2",
2032
+ "resolved": "https://registry.npmjs.org/got/-/got-12.5.2.tgz",
2033
+ "integrity": "sha512-guHGMSEcsA5m1oPRweXUJnug0vuvlkX9wx5hzOka+ZBrBUOJHU0Z1JcNu3QE5IPGnA5aXUsQHdWOD4eJg9/v3A==",
2021
2034
  "requires": {
2022
2035
  "@sindresorhus/is": "^5.2.0",
2023
2036
  "@szmarczak/http-timer": "^5.0.1",
@@ -2061,18 +2074,18 @@
2061
2074
  }
2062
2075
  },
2063
2076
  "html-snapshots": {
2064
- "version": "1.0.1",
2065
- "resolved": "https://registry.npmjs.org/html-snapshots/-/html-snapshots-1.0.1.tgz",
2066
- "integrity": "sha512-BnVQ7pL/ybYWVdoktSHvp1NybZ1UOt3xd5vTQ8agO388hwU63oTqgZV4Xe2nxW0Bb83Xia9/VNiWPGrJ320Uhw==",
2077
+ "version": "1.2.0",
2078
+ "resolved": "https://registry.npmjs.org/html-snapshots/-/html-snapshots-1.2.0.tgz",
2079
+ "integrity": "sha512-/erOUW66PXzxzmq9daIt9F/sOGtLCKIjT7VuFUutNeZCtjiK6eM6bBiF9CFq9SOsyJ1sWqFasBUsq7F9GSnWpA==",
2067
2080
  "requires": {
2068
2081
  "async": "3.2.4",
2069
2082
  "async-lock": "1.3.2",
2070
2083
  "combine-errors": "3.0.3",
2071
- "got": "12.5.1",
2084
+ "got": "12.5.2",
2072
2085
  "lodash": "4.17.21",
2073
2086
  "mkdirp": "1.0.4",
2074
2087
  "phantomjs-prebuilt": "2.1.16",
2075
- "puppeteer": "^18.0.5",
2088
+ "puppeteer": "^19.0.0",
2076
2089
  "rimraf": "3.0.2",
2077
2090
  "xml2js": "0.4.23"
2078
2091
  }
@@ -2449,21 +2462,38 @@
2449
2462
  "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
2450
2463
  },
2451
2464
  "puppeteer": {
2452
- "version": "18.0.5",
2453
- "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-18.0.5.tgz",
2454
- "integrity": "sha512-s4erjxU0VtKojPvF+KvLKG6OHUPw7gO2YV1dtOsoryyCbhrs444fXb4QZqGWuTv3V/rgSCUzeixxu34g0ZkSMA==",
2465
+ "version": "19.0.0",
2466
+ "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-19.0.0.tgz",
2467
+ "integrity": "sha512-3Ga5IVerQQ2hKU9q7T28RmcUsd8F2kL6cYuPcPCzeclSjmHhGydPBZL/KJKC02sG6J6Wfry85uiWpbkjQ5qBiw==",
2468
+ "requires": {
2469
+ "https-proxy-agent": "5.0.1",
2470
+ "progress": "2.0.3",
2471
+ "proxy-from-env": "1.1.0",
2472
+ "puppeteer-core": "19.0.0"
2473
+ },
2474
+ "dependencies": {
2475
+ "progress": {
2476
+ "version": "2.0.3",
2477
+ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
2478
+ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA=="
2479
+ }
2480
+ }
2481
+ },
2482
+ "puppeteer-core": {
2483
+ "version": "19.0.0",
2484
+ "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-19.0.0.tgz",
2485
+ "integrity": "sha512-OljQ9W5M4cBX68vnOAGbcRkVENDHn6lfj6QYoGsnLQsxPAh6ExTQAhHauwdFdQkhYdDExZFWlKArnBONzeHY+g==",
2455
2486
  "requires": {
2456
2487
  "cross-fetch": "3.1.5",
2457
2488
  "debug": "4.3.4",
2458
- "devtools-protocol": "0.0.1036444",
2489
+ "devtools-protocol": "0.0.1045489",
2459
2490
  "extract-zip": "2.0.1",
2460
2491
  "https-proxy-agent": "5.0.1",
2461
- "progress": "2.0.3",
2462
2492
  "proxy-from-env": "1.1.0",
2463
2493
  "rimraf": "3.0.2",
2464
2494
  "tar-fs": "2.1.1",
2465
2495
  "unbzip2-stream": "1.4.3",
2466
- "ws": "8.8.1"
2496
+ "ws": "8.9.0"
2467
2497
  },
2468
2498
  "dependencies": {
2469
2499
  "debug": {
@@ -2497,11 +2527,6 @@
2497
2527
  "version": "2.1.2",
2498
2528
  "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
2499
2529
  "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
2500
- },
2501
- "progress": {
2502
- "version": "2.0.3",
2503
- "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
2504
- "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA=="
2505
2530
  }
2506
2531
  }
2507
2532
  },
@@ -2773,9 +2798,9 @@
2773
2798
  "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
2774
2799
  },
2775
2800
  "ws": {
2776
- "version": "8.8.1",
2777
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.1.tgz",
2778
- "integrity": "sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA==",
2801
+ "version": "8.9.0",
2802
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.9.0.tgz",
2803
+ "integrity": "sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg==",
2779
2804
  "requires": {}
2780
2805
  },
2781
2806
  "xml2js": {
@@ -7,6 +7,6 @@
7
7
  "start": "node ./snapshot.js"
8
8
  },
9
9
  "dependencies": {
10
- "html-snapshots": "^1.0.1"
10
+ "html-snapshots": "^1.2.0"
11
11
  }
12
12
  }
@@ -154,7 +154,8 @@ function phantomjsWorker (input, options, notifier, qcb) {
154
154
  * @param {String} input.url - The url to get the html from.
155
155
  * @param {String} input.selector - The selector to wait for.
156
156
  * @param {String} input.timeout - The entire process timeout.
157
- * @param {String} input.debug - The debug object.
157
+ * @param {Object} input.debug - The debug object.
158
+ * @param {Object} input.puppeteerLaunchOptions - overriding puppeteer launch options.
158
159
  * @param {Object} options - Input options.
159
160
  * @param {Object} options.snapshotScript - Snapshot script options.
160
161
  * @param {String} options.snapshotScript.script - Snapshot script name.
@@ -192,7 +193,8 @@ function puppeteerWorker (input, options, notifier, qcb) {
192
193
  input.timeout,
193
194
  filter,
194
195
  input.debug.flag,
195
- input.debug.slowMo
196
+ input.debug.slowMo,
197
+ JSON.stringify(input.puppeteerLaunchOptions)
196
198
  ], { cwd: process.cwd(), stdio: "inherit", detached: true }
197
199
  );
198
200
 
@@ -27,6 +27,7 @@ const defaults = Object.freeze({
27
27
  useJQuery: false,
28
28
  verbose: false,
29
29
  phantomjsOptions: "",
30
+ puppeteerLaunchOptions: {},
30
31
  debug: {
31
32
  flag: "false",
32
33
  slowMo: 500
@@ -86,6 +87,23 @@ function supplyMissingDefault (options, name) {
86
87
  }
87
88
  }
88
89
 
90
+ /**
91
+ * Prepare single Object options so that it is always used for all pages (globally).
92
+ *
93
+ * @param {String} name - The property name.
94
+ * @param {Object} options - Input generator options.
95
+ */
96
+ function prepSingleObjectOptions (name, options) {
97
+ const objectOpt = options[name];
98
+ const toString = Object.prototype.toString;
99
+ const isObj = toString.call(objectOpt) === "[object Object]";
100
+ if (isObj) {
101
+ options[name] = {
102
+ __default: objectOpt
103
+ };
104
+ }
105
+ }
106
+
89
107
  /**
90
108
  * Prepare options for use by an input generator.
91
109
  *
@@ -96,11 +114,20 @@ function prepOptions (options, listener) {
96
114
  // Ensure defaults are represented
97
115
  common.ensure(options, defaults);
98
116
 
117
+ // Prep single, global object options for normalization.
118
+ [
119
+ "puppeteerLaunchOptions"
120
+ ]
121
+ .forEach((optionName) => {
122
+ prepSingleObjectOptions(optionName, options);
123
+ });
124
+
99
125
  // Normalize certain arguments if they are not functions.
100
126
  // The certain arguments are per-page options.
101
127
  // However, outputPath is a special case
102
128
  [
103
- "selector", "timeout", "useJQuery", "verbose", "phantomjsOptions"
129
+ "selector", "timeout", "useJQuery", "verbose", "phantomjsOptions",
130
+ "puppeteerLaunchOptions"
104
131
  ]
105
132
  .forEach((perPageOption) => {
106
133
  options[perPageOption] = normalize(options[perPageOption]);
@@ -228,7 +255,8 @@ module.exports = {
228
255
  * @param {Function} options.userJQuery - Produces a jquery bool given a page url.
229
256
  * @param {Function} options.verbose - Produces a verbose bool given a page url.
230
257
  * @param {Function} options.phantomjsOptions - Produces phantomjs options given a page url.
231
- * @param {Function} options.debug - Produces debug options given a page url.
258
+ * @param {Function} options.puppeteerLaunchOptions - Produces puppeteer launch options given a page url.
259
+ * @param {Object} options.debug - Produces debug options given a page url.
232
260
  * @param {Function} options._inputEmitter - The EventEmitter to generate input.
233
261
  * @param {String} page - The url to the page resource.
234
262
  * @returns {String} The full output file path.
@@ -262,7 +290,9 @@ module.exports = {
262
290
  verbose: options.verbose(page),
263
291
  // map the input page to phantomJS options
264
292
  phantomjsOptions: options.phantomjsOptions(page),
265
- // useful for testing, debugging
293
+ // map the input page to puppeteer launch options
294
+ puppeteerLaunchOptions: options.puppeteerLaunchOptions(page),
295
+ // useful for puppeteer testing, debugging
266
296
  debug: options.debug,
267
297
  __page: page
268
298
  });
@@ -12,6 +12,7 @@
12
12
  * [6] - filter
13
13
  * [7] - debug
14
14
  * [8] - slowMo
15
+ * [9] - arbitrary launchOptions
15
16
  */
16
17
  const puppeteer = require('puppeteer');
17
18
  const path = require('path');
@@ -31,13 +32,17 @@ const options = {
31
32
  timeout: process.argv[5] ? parseInt(process.argv[5], 10) : 10000,
32
33
  filter: process.argv[6] && process.argv[6] !== 'false' ? process.argv[6] : null,
33
34
  debug: process.argv[7] && process.argv[7].toLowerCase() === 'true' ? true : false,
34
- slowMo: process.argv[8] ? parseInt(process.argv[8], 10) : 500
35
+ slowMo: process.argv[8] ? parseInt(process.argv[8], 10) : 500,
36
+ launchOpts: process.argv[9] ? JSON.parse(process.argv[9]) : null
37
+ };
38
+ const launchOptions = {
39
+ ...(options.debug ? {
40
+ headless: false,
41
+ slowMo: options.slowMo,
42
+ devtools: true
43
+ } : {}),
44
+ ...(options.launchOpts ?? {})
35
45
  };
36
- const launchOptions = options.debug ? {
37
- headless: false,
38
- slowMo: options.slowMo,
39
- devtools: true
40
- } : {};
41
46
 
42
47
  /**
43
48
  * Run the snapshot script.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-snapshots",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "author": {
5
5
  "name": "Alex Grant",
6
6
  "email": "alex@localnerve.com",
@@ -53,18 +53,18 @@
53
53
  "async": "3.2.4",
54
54
  "async-lock": "1.3.2",
55
55
  "combine-errors": "3.0.3",
56
- "got": "12.5.1",
56
+ "got": "12.5.2",
57
57
  "lodash": "4.17.21",
58
58
  "mkdirp": "1.0.4",
59
59
  "phantomjs-prebuilt": "2.1.16",
60
- "puppeteer": "^18.2.1",
60
+ "puppeteer": "^19.1.1",
61
61
  "rimraf": "3.0.2",
62
62
  "xml2js": "0.4.23"
63
63
  },
64
64
  "devDependencies": {
65
- "eslint": "8.23.1",
66
- "express": "4.18.1",
67
- "mocha": "10.0.0",
65
+ "eslint": "8.26.0",
66
+ "express": "4.18.2",
67
+ "mocha": "10.1.0",
68
68
  "c8": "7.12.0",
69
69
  "precommit-hook": "3.0.0",
70
70
  "server-destroy": "1.0.1",
@@ -43,7 +43,7 @@ function puppeteerTests () {
43
43
  });
44
44
 
45
45
  it("should succeed with minimal args", function (done) {
46
- this.timeout(5000);
46
+ this.timeout(4000);
47
47
 
48
48
  rimraf(outputDir);
49
49
 
@@ -54,6 +54,28 @@ function puppeteerTests () {
54
54
  ], done);
55
55
  });
56
56
 
57
+ it("should succeed with stringified puppeteerLaunchOptions", function (done) {
58
+ this.timeout(4000);
59
+ rimraf(outputDir);
60
+
61
+ // override the debug options to prove stringified launch opts worked.
62
+ const puppeteerLaunchOptions = {
63
+ headless: true,
64
+ devTools: false
65
+ };
66
+
67
+ spawnPuppeteer([
68
+ outputFile,
69
+ `http://localhost:${port}/`,
70
+ "body",
71
+ 4000,
72
+ "false",
73
+ "true",
74
+ 10,
75
+ JSON.stringify(puppeteerLaunchOptions)
76
+ ], done);
77
+ });
78
+
57
79
  it("should fail if insufficient input args", function (done) {
58
80
  rimraf(outputDir);
59
81
 
@@ -98,6 +120,7 @@ function puppeteerTests () {
98
120
  10
99
121
  ], done);
100
122
  });
123
+
101
124
  };
102
125
  }
103
126
 
@@ -921,6 +921,96 @@ describe("input-generator", function () {
921
921
 
922
922
  });
923
923
 
924
+ describe("puppeteerLaunchOptions option", function () {
925
+ it("should accept a single object and apply globally", function (done) {
926
+ let count = 0;
927
+ const puppeteerLaunchOptions = {
928
+ one: 'one',
929
+ two: 2,
930
+ three: ['three', 'four', 'five'],
931
+ six: {
932
+ seven: 'seven'
933
+ }
934
+ };
935
+
936
+ const result = gen.run(options.decorate({
937
+ source,
938
+ puppeteerLaunchOptions,
939
+ outputDir: thisOutputDir
940
+ }), function (input) {
941
+ const classString = Object.prototype.toString;
942
+
943
+ assert.equal(classString.call(input.puppeteerLaunchOptions), classString.call(puppeteerLaunchOptions),
944
+ `${input.__page}:\ninput.puppeteerLaunchOptions should be an object:\n${
945
+ require("util").inspect(input.puppeteerLaunchOptions)
946
+ }`
947
+ );
948
+
949
+ assert.deepEqual(input.puppeteerLaunchOptions, puppeteerLaunchOptions,
950
+ `${input.__page}:\ninput.puppeteerLaunchOptions should be equal to the original input`);
951
+
952
+ count++;
953
+ if (count === urls) {
954
+ done();
955
+ }
956
+ });
957
+
958
+ result
959
+ .then(function () {
960
+ assert.ok(true);
961
+ })
962
+ .catch(function (err) {
963
+ assert.fail(`Run should not fail: ${err.toString()}`);
964
+ });
965
+ });
966
+
967
+ it("should accept a function and apply per url", function (done) {
968
+ const plo1 = { one: "one" },
969
+ plo2 = { two: "two" },
970
+ plo3 = { three: "three" };
971
+
972
+ const globalOptions = {
973
+ "/": plo1,
974
+ "/contact": plo2,
975
+ "/services/carpets": plo3
976
+ };
977
+ const localOptions = {
978
+ "http://northstar.local/": plo1,
979
+ "http://northstar.local/contact": plo2,
980
+ "http://northstar.local/services/carpets": plo3
981
+ };
982
+ const opts = globalUrl ? globalOptions : localOptions;
983
+ let count = 0;
984
+ const ploFn = function (url) {
985
+ return opts[url];
986
+ };
987
+
988
+ const result = gen.run(options.decorate({
989
+ source: source,
990
+ outputDir: thisOutputDir,
991
+ puppeteerLaunchOptions: ploFn
992
+ }), function (input) {
993
+ const testOption = opts[input.__page] ? opts[input.__page] : base.defaults({}).puppeteerLaunchOptions;
994
+
995
+ assert.deepEqual(input.puppeteerLaunchOptions, testOption,
996
+ `${input.__page}:\ninput.puppeteerLaunchOptions: ${input.puppeteerLaunchOptions} != testPuppeteerLaunchOption: ${testOption}`);
997
+
998
+ count++;
999
+ if (count === urls) {
1000
+ done();
1001
+ }
1002
+ });
1003
+
1004
+ result
1005
+ .then(function () {
1006
+ assert.ok(true);
1007
+ })
1008
+ .catch(function (err) {
1009
+ assert.fail(`Run should not fail: ${err.toString()}`);
1010
+ });
1011
+ });
1012
+ });
1013
+
924
1014
  describe("url behavior", function () {
925
1015
 
926
1016
  it("should replace the default hostname in results", function (done) {