html-snapshots 0.17.2 → 0.18.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/.github/workflows/verify.yml +32 -0
- package/{LICENSE → LICENSE.md} +1 -1
- package/README.md +5 -6
- package/examples/custom/myFilter.js +1 -1
- package/examples/custom/package-lock.json +781 -0
- package/examples/custom/package.json +2 -2
- package/examples/custom/snapshot.js +1 -1
- package/examples/debug-phantomjs/package-lock.json +781 -0
- package/examples/debug-phantomjs/package.json +2 -2
- package/examples/debug-phantomjs/snapshot.js +1 -1
- package/examples/html5rocks/package-lock.json +781 -0
- package/examples/html5rocks/package.json +2 -2
- package/examples/html5rocks/snapshot.js +1 -1
- package/examples/process-limit/package-lock.json +781 -0
- package/examples/process-limit/package.json +2 -2
- package/examples/process-limit/snapshot.js +1 -1
- package/examples/simple-promise/package-lock.json +781 -0
- package/examples/simple-promise/package.json +2 -2
- package/examples/simple-promise/snapshot.js +1 -1
- package/examples/sitemap-index/package-lock.json +781 -0
- package/examples/sitemap-index/package.json +2 -2
- package/examples/sitemap-index/snapshot.js +1 -1
- package/examples/utils/index.js +1 -1
- package/examples/verbose/package-lock.json +781 -0
- package/examples/verbose/package.json +2 -2
- package/examples/verbose/snapshot.js +1 -1
- package/lib/async/exists.js +6 -19
- package/lib/async/index.js +1 -1
- package/lib/common/index.js +1 -1
- package/lib/common/node.js +1 -1
- package/lib/common/sitemap.js +1 -1
- package/lib/html-snapshots.js +1 -1
- package/lib/input-generators/_base.js +1 -1
- package/lib/input-generators/array.js +1 -1
- package/lib/input-generators/index.js +1 -1
- package/lib/input-generators/robots.js +1 -1
- package/lib/input-generators/sitemap-index.js +1 -1
- package/lib/input-generators/sitemap.js +1 -1
- package/lib/input-generators/textfile.js +1 -1
- package/lib/phantom/customFilter.js +1 -1
- package/lib/phantom/default.js +1 -1
- package/lib/phantom/modules/cli.js +1 -1
- package/lib/phantom/modules/detectors.js +1 -1
- package/lib/phantom/modules/globals.js +1 -1
- package/lib/phantom/modules/selectorDetect.js +1 -1
- package/lib/phantom/modules/verbose.js +1 -1
- package/lib/phantom/removeScripts.js +1 -1
- package/package.json +19 -18
- package/test/helpers/options.js +1 -1
- package/test/helpers/result.js +1 -1
- package/test/helpers/sitemap.js +1 -1
- package/test/mocha/async/test.js +8 -8
- package/test/mocha/common/helpers.js +1 -1
- package/test/mocha/common/node.js +1 -1
- package/test/mocha/common/test.js +1 -1
- package/test/mocha/html-snapshots/basics.js +5 -7
- package/test/mocha/html-snapshots/myFilter.js +1 -1
- package/test/mocha/html-snapshots/phantomjs-options.js +33 -10
- package/test/mocha/html-snapshots/process-limit.js +1 -1
- package/test/mocha/html-snapshots/robots.js +1 -1
- package/test/mocha/html-snapshots/sitemap-index.js +1 -1
- package/test/mocha/html-snapshots/sitemap.js +1 -1
- package/test/mocha/html-snapshots/snapshot-scripts.js +1 -1
- package/test/mocha/html-snapshots/test.js +1 -1
- package/test/mocha/html-snapshots/use-jquery.js +1 -1
- package/test/mocha/html-snapshots/utils.js +9 -4
- package/test/mocha/input-generators/sitemap-index.js +1 -1
- package/test/mocha/input-generators/sitemap.js +1 -1
- package/test/mocha/input-generators/test.js +1 -1
- package/test/server/index.js +1 -1
- package/.travis.yml +0 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Snapshot an example website.
|
|
3
|
-
* Copyright (c) 2013 -
|
|
3
|
+
* Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
|
|
4
4
|
*
|
|
5
5
|
* Use sitemap.xml to snapshot an entire site.
|
|
6
6
|
* Use the verbose option to debug the loading of one of the pages.
|
package/lib/async/exists.js
CHANGED
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
* Empirically, I found that either one of these NodeJS checks can fail,
|
|
6
6
|
* but both don't. This is a workaround.
|
|
7
7
|
*
|
|
8
|
-
* Copyright (c) 2013 -
|
|
8
|
+
* Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
|
|
9
9
|
* Licensed under the MIT license.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const fs = require("fs");
|
|
13
|
-
const nodeCall = require("../common/node");
|
|
12
|
+
const fs = require("fs").promises;
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* Check if a path exists.
|
|
@@ -21,22 +20,10 @@ const nodeCall = require("../common/node");
|
|
|
21
20
|
* success. Otherwise, resolve to boolean. Defaults to false (boolean).
|
|
22
21
|
* @returns {Promise} Resolves to true (or file) if exists, false otherwise.
|
|
23
22
|
*/
|
|
24
|
-
function pathExists (path,
|
|
25
|
-
|
|
26
|
-
returnFile:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// Defaults to F_OK
|
|
30
|
-
return nodeCall(fs.access, path)
|
|
31
|
-
.then(() => {
|
|
32
|
-
return options.returnFile ? path : true;
|
|
33
|
-
})
|
|
34
|
-
.catch(() => {
|
|
35
|
-
if (fs.existsSync(path)) {
|
|
36
|
-
return options.returnFile ? path : true;
|
|
37
|
-
}
|
|
38
|
-
return false;
|
|
39
|
-
});
|
|
23
|
+
function pathExists (path, { returnFile=false }={ returnFile: false }) {
|
|
24
|
+
return fs.access(path)
|
|
25
|
+
.then(() => returnFile ? path : true)
|
|
26
|
+
.catch(() => false);
|
|
40
27
|
}
|
|
41
28
|
|
|
42
29
|
module.exports = pathExists;
|
package/lib/async/index.js
CHANGED
package/lib/common/index.js
CHANGED
package/lib/common/node.js
CHANGED
package/lib/common/sitemap.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* An input generator for html-snapshots that uses a sitemap.xml file.
|
|
5
5
|
* Creates the snapshot arguments driven from sitemap.xml urls.
|
|
6
6
|
*
|
|
7
|
-
* Copyright (c) 2013 -
|
|
7
|
+
* Copyright (c) 2013 - 2022 Alex Grant, LocalNerve, contributors
|
|
8
8
|
* Licensed under the MIT license.
|
|
9
9
|
*/
|
|
10
10
|
|
package/lib/html-snapshots.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* By default, uses a selector to search content to determine if
|
|
7
7
|
* a page is "ready" for its html snapshot.
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2013 -
|
|
9
|
+
* Copyright (c) 2013 - 2022 Alex Grant, LocalNerve, contributors
|
|
10
10
|
* Licensed under the MIT license.
|
|
11
11
|
*/
|
|
12
12
|
/* global Promise */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* An input generator for html-snapshots that uses a javascript array
|
|
5
5
|
* to generate snapshot input from the host relative page urls.
|
|
6
6
|
*
|
|
7
|
-
* Copyright (c) 2013 -
|
|
7
|
+
* Copyright (c) 2013 - 2022 Alex Grant, LocalNerve, contributors
|
|
8
8
|
* Licensed under the MIT license.
|
|
9
9
|
*/
|
|
10
10
|
/* global Promise */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Input generator factory
|
|
5
5
|
* Create an input generator that produces snapshots arguments
|
|
6
6
|
*
|
|
7
|
-
* Copyright (c) 2013 -
|
|
7
|
+
* Copyright (c) 2013 - 2022 Alex Grant, LocalNerve, contributors
|
|
8
8
|
* Licensed under the MIT license.
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Does not support wildcards.
|
|
7
7
|
* If you need wildcards, use the sitemap input generator.
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2013 -
|
|
9
|
+
* Copyright (c) 2013 - 2022 Alex Grant, LocalNerve, contributors
|
|
10
10
|
* Licensed under the MIT license.
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* An input generator for html-snapshots that uses a sitemap index xml file.
|
|
5
5
|
* Creates the snapshot arguments driven from multiple sitemap.xml urls.
|
|
6
6
|
*
|
|
7
|
-
* Copyright (c) 2013 -
|
|
7
|
+
* Copyright (c) 2013 - 2022 Alex Grant, LocalNerve, contributors
|
|
8
8
|
* Licensed under the MIT license.
|
|
9
9
|
*/
|
|
10
10
|
/* global Promise */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* An input generator for html-snapshots that uses a sitemap.xml file.
|
|
5
5
|
* Creates the snapshot arguments driven from sitemap.xml urls.
|
|
6
6
|
*
|
|
7
|
-
* Copyright (c) 2013 -
|
|
7
|
+
* Copyright (c) 2013 - 2022 Alex Grant, LocalNerve, contributors
|
|
8
8
|
* Licensed under the MIT license.
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* An input generator for html-snapshots that uses a simple text file
|
|
5
5
|
* with the host relative page urls, one per line.
|
|
6
6
|
*
|
|
7
|
-
* Copyright (c) 2013 -
|
|
7
|
+
* Copyright (c) 2013 - 2022 Alex Grant, LocalNerve, contributors
|
|
8
8
|
* Licensed under the MIT license.
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This is a phantomJS script that runs in phantomjs.
|
|
9
9
|
*
|
|
10
|
-
* Copyright (c) 2013 -
|
|
10
|
+
* Copyright (c) 2013 - 2022 Alex Grant, LocalNerve, contributors
|
|
11
11
|
* Licensed under the MIT license.
|
|
12
12
|
*/
|
|
13
13
|
var selectorDetect = require("./modules/selectorDetect");
|
package/lib/phantom/default.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This is a phantomJS script that runs in phantomjs.
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2013 -
|
|
9
|
+
* Copyright (c) 2013 - 2022 Alex Grant, LocalNerve, contributors
|
|
10
10
|
* Licensed under the MIT license.
|
|
11
11
|
*/
|
|
12
12
|
var selectorDetect = require("./modules/selectorDetect");
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* This is a module for a phantomJS script that runs in phantomjs.
|
|
13
13
|
*
|
|
14
|
-
* Copyright (c) 2013 -
|
|
14
|
+
* Copyright (c) 2013 - 2022 Alex Grant, LocalNerve, contributors
|
|
15
15
|
* Licensed under the MIT license.
|
|
16
16
|
*/
|
|
17
17
|
/* global document, $ */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* This is a module for a phantomJS script that runs in phantomjs.
|
|
7
7
|
*
|
|
8
|
-
* Copyright (c) 2013 -
|
|
8
|
+
* Copyright (c) 2013 - 2022 Alex Grant, LocalNerve, contributors
|
|
9
9
|
* Licensed under the MIT license.
|
|
10
10
|
*/
|
|
11
11
|
/* global phantom */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* This is a module for a phantomJS script that runs in phantomjs.
|
|
7
7
|
*
|
|
8
|
-
* Copyright (c) 2013 -
|
|
8
|
+
* Copyright (c) 2013 - 2022 Alex Grant, LocalNerve, contributors
|
|
9
9
|
* Licensed under the MIT license.
|
|
10
10
|
*/
|
|
11
11
|
/* global window */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This is a phantomJS script that runs in phantomjs.
|
|
9
9
|
*
|
|
10
|
-
* Copyright (c) 2013 -
|
|
10
|
+
* Copyright (c) 2013 - 2022 Alex Grant, LocalNerve, contributors
|
|
11
11
|
* Licensed under the MIT license.
|
|
12
12
|
*/
|
|
13
13
|
var selectorDetect = require("./modules/selectorDetect");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "html-snapshots",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Alex Grant",
|
|
6
6
|
"email": "alex@localnerve.com",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"test:common": "mocha test/mocha/common/*.js --exit --reporter spec",
|
|
25
25
|
"test:input-generators": "mocha test/mocha/input-generators/*.js --exit --reporter spec",
|
|
26
26
|
"test:html-snapshots": "mocha test/mocha/html-snapshots/*.js --exit --reporter spec",
|
|
27
|
-
"
|
|
27
|
+
"test:cover": "istanbul cover -- _mocha test/mocha/**/*.js --exit --recursive --reporter spec",
|
|
28
28
|
"validate": "npm ls"
|
|
29
29
|
},
|
|
30
30
|
"pre-commit": [
|
|
@@ -46,28 +46,29 @@
|
|
|
46
46
|
"sitemap.xml"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"async": "3.2.
|
|
50
|
-
"async-lock": "1.
|
|
49
|
+
"async": "3.2.3",
|
|
50
|
+
"async-lock": "1.3.1",
|
|
51
51
|
"combine-errors": "3.0.3",
|
|
52
|
-
"lodash": "
|
|
53
|
-
"mkdirp": "
|
|
52
|
+
"lodash": "4.17.21",
|
|
53
|
+
"mkdirp": "1.0.4",
|
|
54
54
|
"phantomjs-prebuilt": "2.1.16",
|
|
55
|
-
"request": "
|
|
56
|
-
"rimraf": "
|
|
57
|
-
"xml2js": "
|
|
55
|
+
"request": "2.88.2",
|
|
56
|
+
"rimraf": "3.0.2",
|
|
57
|
+
"xml2js": "0.4.23"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"coveralls": "
|
|
61
|
-
"eslint": "
|
|
62
|
-
"express": "
|
|
63
|
-
"mocha": "
|
|
64
|
-
"istanbul": "
|
|
65
|
-
"precommit-hook": "
|
|
66
|
-
"server-destroy": "
|
|
67
|
-
"sitemap-xml": "
|
|
60
|
+
"coveralls": "3.1.1",
|
|
61
|
+
"eslint": "8.12.0",
|
|
62
|
+
"express": "4.17.3",
|
|
63
|
+
"mocha": "9.2.2",
|
|
64
|
+
"istanbul": "0.4.5",
|
|
65
|
+
"precommit-hook": "3.0.0",
|
|
66
|
+
"server-destroy": "1.0.1",
|
|
67
|
+
"sitemap-xml": "0.1.0",
|
|
68
|
+
"handlebars": "4.7.7"
|
|
68
69
|
},
|
|
69
70
|
"license": "MIT",
|
|
70
71
|
"engines": {
|
|
71
|
-
"node": ">=
|
|
72
|
+
"node": ">= 14"
|
|
72
73
|
}
|
|
73
74
|
}
|
package/test/helpers/options.js
CHANGED
package/test/helpers/result.js
CHANGED
package/test/helpers/sitemap.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Helper to add dynamic url nodes to a test sitemap.
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c) 2013 -
|
|
4
|
+
* Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
|
|
5
5
|
*/
|
|
6
6
|
var smLib = require("sitemap-xml");
|
|
7
7
|
var urlLib = require("url");
|
package/test/mocha/async/test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Async module tests.
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c) 2013 -
|
|
4
|
+
* Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
|
|
5
5
|
*/
|
|
6
6
|
/* global describe, beforeEach, it */
|
|
7
7
|
var assert = require("assert");
|
|
@@ -97,7 +97,7 @@ describe("async", function () {
|
|
|
97
97
|
});
|
|
98
98
|
|
|
99
99
|
mkdirp.sync(dir);
|
|
100
|
-
assert.
|
|
100
|
+
assert.doesNotThrow(fs.accessSync.bind(null, dir));
|
|
101
101
|
|
|
102
102
|
files.forEach(function (file) {
|
|
103
103
|
notifier.add(file, timeout);
|
|
@@ -139,7 +139,7 @@ describe("async", function () {
|
|
|
139
139
|
});
|
|
140
140
|
|
|
141
141
|
mkdirp.sync(dir);
|
|
142
|
-
assert.
|
|
142
|
+
assert.doesNotThrow(fs.accessSync.bind(null, dir));
|
|
143
143
|
|
|
144
144
|
files.forEach(function(file) {
|
|
145
145
|
notifier.add(file, timeout);
|
|
@@ -188,7 +188,7 @@ describe("async", function () {
|
|
|
188
188
|
});
|
|
189
189
|
|
|
190
190
|
mkdirp.sync(dir);
|
|
191
|
-
assert.
|
|
191
|
+
assert.doesNotThrow(fs.accessSync.bind(null, dir));
|
|
192
192
|
|
|
193
193
|
files.forEach(function (file) {
|
|
194
194
|
notifier.add(file, timeout);
|
|
@@ -229,7 +229,7 @@ describe("async", function () {
|
|
|
229
229
|
});
|
|
230
230
|
|
|
231
231
|
mkdirp.sync(dir);
|
|
232
|
-
assert.
|
|
232
|
+
assert.doesNotThrow(fs.accessSync.bind(null, dir));
|
|
233
233
|
|
|
234
234
|
files.forEach(function (file) {
|
|
235
235
|
notifier.add(file, timeout);
|
|
@@ -301,7 +301,7 @@ describe("async", function () {
|
|
|
301
301
|
});
|
|
302
302
|
|
|
303
303
|
mkdirp.sync(dir);
|
|
304
|
-
assert.
|
|
304
|
+
assert.doesNotThrow(fs.accessSync.bind(null, dir));
|
|
305
305
|
|
|
306
306
|
files.forEach(function (file) {
|
|
307
307
|
notifier.add(file, timeout);
|
|
@@ -337,7 +337,7 @@ describe("async", function () {
|
|
|
337
337
|
});
|
|
338
338
|
|
|
339
339
|
mkdirp.sync(dir);
|
|
340
|
-
assert.
|
|
340
|
+
assert.doesNotThrow(fs.accessSync.bind(null, dir));
|
|
341
341
|
|
|
342
342
|
files.forEach(function (file) {
|
|
343
343
|
notifier.add(file, timeout);
|
|
@@ -381,7 +381,7 @@ describe("async", function () {
|
|
|
381
381
|
});
|
|
382
382
|
|
|
383
383
|
mkdirp.sync(dir);
|
|
384
|
-
assert.
|
|
384
|
+
assert.doesNotThrow(fs.accessSync.bind(null, dir));
|
|
385
385
|
|
|
386
386
|
// create a worker queue, attach qEmpty
|
|
387
387
|
var q = asyncLib.queue(function (task, callback) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Basic library tests.
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c) 2013 -
|
|
4
|
+
* Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
|
|
5
5
|
*/
|
|
6
6
|
/* global it */
|
|
7
7
|
var assert = require("assert");
|
|
@@ -40,11 +40,9 @@ function basicTests () {
|
|
|
40
40
|
var file = path.join(dir, "somefile.txt");
|
|
41
41
|
var twice = _.after(2, cleanupError.bind(null, done, 0));
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
fs.mkdirSync(dir);
|
|
45
|
-
}
|
|
43
|
+
fs.mkdirSync(dir);
|
|
46
44
|
fs.writeFileSync(file, "some data");
|
|
47
|
-
assert.
|
|
45
|
+
assert.doesNotThrow(fs.accessSync.bind(null, dir));
|
|
48
46
|
|
|
49
47
|
ss.run(optHelp.decorate({
|
|
50
48
|
source: bogusFile,
|
|
@@ -54,7 +52,7 @@ function basicTests () {
|
|
|
54
52
|
.then(unexpectedSuccess.bind(null, done))
|
|
55
53
|
.catch(twice);
|
|
56
54
|
|
|
57
|
-
assert.
|
|
55
|
+
assert.throws(fs.accessSync.bind(null, dir));
|
|
58
56
|
});
|
|
59
57
|
|
|
60
58
|
it("default snapshot script should exist", function (done) {
|
|
@@ -63,7 +61,7 @@ function basicTests () {
|
|
|
63
61
|
|
|
64
62
|
var result = ss.run(optHelp.decorate(options), twice);
|
|
65
63
|
|
|
66
|
-
assert.
|
|
64
|
+
assert.doesNotThrow(fs.accessSync.bind(null, options.snapshotScript));
|
|
67
65
|
|
|
68
66
|
result
|
|
69
67
|
.then(unexpectedSuccess.bind(null, done))
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* In-test, custom filter script.
|
|
3
3
|
* Adds a custom tag onto the body.
|
|
4
4
|
*
|
|
5
|
-
* Copyright (c) 2013 -
|
|
5
|
+
* Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
|
|
6
6
|
*/
|
|
7
7
|
module.exports = function(content) {
|
|
8
8
|
console.log("IN THE CUSTOMFILTER");
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Library tests focused on the phantomjsOptions option.
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c) 2013 -
|
|
4
|
+
* Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
|
|
5
5
|
*/
|
|
6
6
|
/* global it */
|
|
7
|
-
var assert = require("assert");
|
|
8
7
|
var path = require("path");
|
|
9
8
|
var fs = require("fs");
|
|
10
9
|
var rimraf = require("rimraf").sync;
|
|
@@ -28,6 +27,30 @@ function phantomjsOptionsTests (options) {
|
|
|
28
27
|
var port = options.port;
|
|
29
28
|
|
|
30
29
|
return function () {
|
|
30
|
+
it ("should work on first vanilla full invocation, no checks", function (done) {
|
|
31
|
+
var options = {
|
|
32
|
+
input: "array",
|
|
33
|
+
source: [ "http://localhost:"+port+"/pjsopts" ],
|
|
34
|
+
outputDir: outputDir,
|
|
35
|
+
outputDirClean: false,
|
|
36
|
+
selector: ".content-complete",
|
|
37
|
+
timeout: timeout,
|
|
38
|
+
phantomjsOptions: "--cookies-file="+cookiesFile
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
rimraf(outputBase);
|
|
42
|
+
|
|
43
|
+
ss.run(optHelp.decorate(options))
|
|
44
|
+
.then(() => {
|
|
45
|
+
cleanup(done);
|
|
46
|
+
}).catch(e => {
|
|
47
|
+
checkActualFiles(e.notCompleted)
|
|
48
|
+
.then(() => {
|
|
49
|
+
cleanup(done, e || unexpectedError);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
31
54
|
it("should work with one string option", function (done) {
|
|
32
55
|
var options = {
|
|
33
56
|
input: "array",
|
|
@@ -46,16 +69,16 @@ function phantomjsOptionsTests (options) {
|
|
|
46
69
|
console.log('@@@ error = '+err+", completed="+completed.join(','));
|
|
47
70
|
}
|
|
48
71
|
})
|
|
49
|
-
.then(
|
|
72
|
+
.then(() => {
|
|
50
73
|
var assertionError;
|
|
51
74
|
try {
|
|
52
|
-
|
|
75
|
+
fs.accessSync(cookiesFile);
|
|
53
76
|
} catch (e) {
|
|
54
77
|
assertionError = e;
|
|
55
78
|
}
|
|
56
79
|
cleanup(done, assertionError);
|
|
57
80
|
})
|
|
58
|
-
.catch(
|
|
81
|
+
.catch(e => {
|
|
59
82
|
checkActualFiles(e.notCompleted)
|
|
60
83
|
.then(function () {
|
|
61
84
|
cleanup(done, e || unexpectedError);
|
|
@@ -84,18 +107,18 @@ function phantomjsOptionsTests (options) {
|
|
|
84
107
|
console.log('@@@ error = '+err+", completed="+completed.join(','));
|
|
85
108
|
}
|
|
86
109
|
})
|
|
87
|
-
.then(
|
|
110
|
+
.then(() => {
|
|
88
111
|
var assertionError;
|
|
89
112
|
try {
|
|
90
|
-
|
|
113
|
+
fs.accessSync(cookiesFile);
|
|
91
114
|
} catch (e) {
|
|
92
115
|
assertionError = e;
|
|
93
116
|
}
|
|
94
117
|
cleanup(done, assertionError);
|
|
95
118
|
})
|
|
96
|
-
.catch(
|
|
119
|
+
.catch(e => {
|
|
97
120
|
checkActualFiles(e.notCompleted)
|
|
98
|
-
.then(
|
|
121
|
+
.then(() => {
|
|
99
122
|
cleanup(done, e || unexpectedError);
|
|
100
123
|
});
|
|
101
124
|
});
|
|
@@ -119,7 +142,7 @@ function phantomjsOptionsTests (options) {
|
|
|
119
142
|
|
|
120
143
|
ss.run(optHelp.decorate(options))
|
|
121
144
|
.then(unexpectedSuccess.bind(null, done))
|
|
122
|
-
.catch(
|
|
145
|
+
.catch(err => {
|
|
123
146
|
var assertionError;
|
|
124
147
|
try {
|
|
125
148
|
resHelp.mustBeError(err);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Library tests focused on the phantomjsOptions option.
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c) 2013 -
|
|
4
|
+
* Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
|
|
5
5
|
*/
|
|
6
6
|
/* global beforeEach, describe, it */
|
|
7
7
|
// var assert = require("assert");
|