doc-detective 2.11.3 → 2.12.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/.doc-detective.json +6 -4
- package/package.json +3 -3
- package/samples/.doc-detective.json +7 -18
- package/src/utils.js +6 -4
- package/test/utils.test.js +2 -0
package/.doc-detective.json
CHANGED
|
@@ -25,22 +25,24 @@
|
|
|
25
25
|
"markup": [
|
|
26
26
|
{
|
|
27
27
|
"name": "Hyperlink",
|
|
28
|
-
"regex": ["(
|
|
28
|
+
"regex": ["(?<!!)\\[.+?\\]\\(.+?\\)"],
|
|
29
29
|
"actions": ["checkLink"]
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
"name": "Navigation link",
|
|
33
|
-
"regex": [
|
|
33
|
+
"regex": [
|
|
34
|
+
"(?:[Cc]hose|[Oo]pen|[Cc]lick|[Nn]avigate to|[Gg]o to)(?<!!)\\[.+?\\]\\(.+?\\)"
|
|
35
|
+
],
|
|
34
36
|
"actions": ["goTo"]
|
|
35
37
|
},
|
|
36
38
|
{
|
|
37
39
|
"name": "Onscreen text",
|
|
38
|
-
"regex": ["
|
|
40
|
+
"regex": ["\\*\\*.+?\\*\\*"],
|
|
39
41
|
"actions": ["find"]
|
|
40
42
|
},
|
|
41
43
|
{
|
|
42
44
|
"name": "Image",
|
|
43
|
-
"regex": ["
|
|
45
|
+
"regex": ["!\\[.+?\\]\\(.+?\\)"],
|
|
44
46
|
"actions": [
|
|
45
47
|
{
|
|
46
48
|
"name": "saveScreenshot",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doc-detective",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"description": "Treat doc content as testable assertions to validate doc accuracy and product UX.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"doc-detective": "src/index.js"
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/doc-detective/doc-detective#readme",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"doc-detective-common": "^1.
|
|
35
|
-
"doc-detective-core": "2.
|
|
34
|
+
"doc-detective-common": "^1.16.0",
|
|
35
|
+
"doc-detective-core": "^2.12.0",
|
|
36
36
|
"prompt-sync": "^4.2.0",
|
|
37
37
|
"yargs": "^17.7.2"
|
|
38
38
|
},
|
|
@@ -12,20 +12,7 @@
|
|
|
12
12
|
"cleanup": "",
|
|
13
13
|
"recursive": true,
|
|
14
14
|
"mediaDirectory": ".",
|
|
15
|
-
"downloadDirectory": "."
|
|
16
|
-
"contexts": [
|
|
17
|
-
{
|
|
18
|
-
"app": {
|
|
19
|
-
"name": "firefox",
|
|
20
|
-
"options": {
|
|
21
|
-
"width": 1200,
|
|
22
|
-
"height": 800,
|
|
23
|
-
"headless": false
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"platforms": ["linux", "mac", "windows"]
|
|
27
|
-
}
|
|
28
|
-
]
|
|
15
|
+
"downloadDirectory": "."
|
|
29
16
|
},
|
|
30
17
|
"runCoverage": {
|
|
31
18
|
"recursive": true,
|
|
@@ -52,22 +39,24 @@
|
|
|
52
39
|
"markup": [
|
|
53
40
|
{
|
|
54
41
|
"name": "Hyperlink",
|
|
55
|
-
"regex": ["(
|
|
42
|
+
"regex": ["(?<!!)\\[.+?\\]\\(.+?\\)"],
|
|
56
43
|
"actions": ["checkLink"]
|
|
57
44
|
},
|
|
58
45
|
{
|
|
59
46
|
"name": "Navigation link",
|
|
60
|
-
"regex": [
|
|
47
|
+
"regex": [
|
|
48
|
+
"(?:[Cc]hose|[Oo]pen|[Cc]lick|[Nn]avigate to|[Gg]o to)(?<!!)\\[.+?\\]\\(.+?\\)"
|
|
49
|
+
],
|
|
61
50
|
"actions": ["goTo"]
|
|
62
51
|
},
|
|
63
52
|
{
|
|
64
53
|
"name": "Onscreen text",
|
|
65
|
-
"regex": ["
|
|
54
|
+
"regex": ["\\*\\*.+?\\*\\*"],
|
|
66
55
|
"actions": ["find"]
|
|
67
56
|
},
|
|
68
57
|
{
|
|
69
58
|
"name": "Image",
|
|
70
|
-
"regex": ["
|
|
59
|
+
"regex": ["!\\[.+?\\]\\(.+?\\)"],
|
|
71
60
|
"actions": [
|
|
72
61
|
{
|
|
73
62
|
"name": "saveScreenshot",
|
package/src/utils.js
CHANGED
|
@@ -115,10 +115,12 @@ function setConfig(config, args) {
|
|
|
115
115
|
|
|
116
116
|
async function outputResults(config, path, results) {
|
|
117
117
|
let data = JSON.stringify(results, null, 2);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
try {
|
|
119
|
+
fs.writeFileSync(path, data);
|
|
120
|
+
console.log(`See results at ${path}`);
|
|
121
|
+
} catch (err) {
|
|
122
|
+
console.error(`Error writing results to ${path}: ${err}`);
|
|
123
|
+
}
|
|
122
124
|
}
|
|
123
125
|
|
|
124
126
|
// Perform a native command in the current working directory.
|
package/test/utils.test.js
CHANGED
|
@@ -178,6 +178,8 @@ describe("Util tests", function () {
|
|
|
178
178
|
const inputResultsPath = path.resolve("./test/test-results.json");
|
|
179
179
|
const inputResultsJSON = require(inputResultsPath);
|
|
180
180
|
const outputResultsPath = path.resolve("./test/output-test-results.json");
|
|
181
|
+
// Check that input file exists
|
|
182
|
+
expect(fs.existsSync(inputResultsPath)).to.equal(true);
|
|
181
183
|
// Output results
|
|
182
184
|
await outputResults(null, outputResultsPath, inputResultsJSON);
|
|
183
185
|
// Check that output file exists
|