doc-detective 2.19.1-dev.0 → 3.0.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/FUNDING.yml +14 -14
- package/.github/dependabot.yml +11 -11
- package/.github/workflows/electron-publish.yml +17 -17
- package/.github/workflows/npm-publish.yml +57 -57
- package/.github/workflows/npm-test.yaml +50 -50
- package/CONTRIBUTIONS.md +27 -27
- package/LICENSE +661 -21
- package/README.md +108 -124
- package/dev/dev.spec.json +62 -62
- package/dev/index.js +5 -5
- package/package.json +44 -46
- package/samples/.doc-detective.json +83 -83
- package/samples/doc-content-detect.md +10 -10
- package/samples/doc-content-inline-tests.md +27 -27
- package/samples/docker-hello.spec.json +14 -14
- package/samples/http.spec.json +26 -26
- package/samples/kitten-search-inline.md +15 -15
- package/samples/kitten-search.spec.json +28 -28
- package/samples/tests.spec.json +70 -70
- package/samples/variables.env +4 -4
- package/src/checkDependencies.js +84 -84
- package/src/index.js +49 -79
- package/src/utils.js +471 -251
- package/test/artifacts/cleanup.spec.json +18 -18
- package/test/artifacts/config.json +44 -44
- package/test/artifacts/doc-content.md +15 -15
- package/test/artifacts/env +2 -2
- package/test/artifacts/httpRequest.spec.json +55 -55
- package/test/artifacts/runShell.spec.json +29 -29
- package/test/artifacts/setup.spec.json +18 -18
- package/test/artifacts/test.spec.json +60 -60
- package/test/runTests.test.js +22 -22
- package/test/test-config.json +12 -12
- package/test/test-results.json +124 -124
- package/test/utils.test.js +170 -210
- package/test/runCoverage.test.js +0 -20
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "cleanup",
|
|
3
|
-
"tests": [
|
|
4
|
-
{
|
|
5
|
-
"steps": [
|
|
6
|
-
{
|
|
7
|
-
"action": "setVariables",
|
|
8
|
-
"path": "
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"action": "runShell",
|
|
12
|
-
"command": "echo",
|
|
13
|
-
"args": ["cleanup"]
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "cleanup",
|
|
3
|
+
"tests": [
|
|
4
|
+
{
|
|
5
|
+
"steps": [
|
|
6
|
+
{
|
|
7
|
+
"action": "setVariables",
|
|
8
|
+
"path": "env"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"action": "runShell",
|
|
12
|
+
"command": "echo",
|
|
13
|
+
"args": ["cleanup"]
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
19
|
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
{
|
|
2
|
-
"envVariables": "",
|
|
3
|
-
"input": ".",
|
|
4
|
-
"output": ".",
|
|
5
|
-
"recursive": true,
|
|
6
|
-
"relativePathBase": "file",
|
|
7
|
-
"logLevel": "debug",
|
|
8
|
-
"runTests": {
|
|
9
|
-
"input": "test.spec.json",
|
|
10
|
-
"output": ".",
|
|
11
|
-
"setup": "",
|
|
12
|
-
"cleanup": "",
|
|
13
|
-
"recursive": true,
|
|
14
|
-
"detectSteps": false,
|
|
15
|
-
"mediaDirectory": ".",
|
|
16
|
-
"downloadDirectory": ".",
|
|
17
|
-
"contexts": [
|
|
18
|
-
{
|
|
19
|
-
"app": { "name": "chrome", "options": { "headless": false } },
|
|
20
|
-
"platforms": ["mac", "linux"]
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"app": { "name": "chrome", "options": { "headless": true } },
|
|
24
|
-
"platforms": ["windows"]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
]
|
|
28
|
-
},
|
|
29
|
-
"runCoverage": {
|
|
30
|
-
"recursive": true,
|
|
31
|
-
"input": ".dev/",
|
|
32
|
-
"output": ".",
|
|
33
|
-
"markup": []
|
|
34
|
-
},
|
|
35
|
-
"suggestTests": {
|
|
36
|
-
"recursive": true,
|
|
37
|
-
"input": ".",
|
|
38
|
-
"output": ".",
|
|
39
|
-
"markup": []
|
|
40
|
-
},
|
|
41
|
-
"telemetry": {
|
|
42
|
-
"send": false
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"envVariables": "",
|
|
3
|
+
"input": ".",
|
|
4
|
+
"output": ".",
|
|
5
|
+
"recursive": true,
|
|
6
|
+
"relativePathBase": "file",
|
|
7
|
+
"logLevel": "debug",
|
|
8
|
+
"runTests": {
|
|
9
|
+
"input": "test.spec.json",
|
|
10
|
+
"output": ".",
|
|
11
|
+
"setup": "",
|
|
12
|
+
"cleanup": "",
|
|
13
|
+
"recursive": true,
|
|
14
|
+
"detectSteps": false,
|
|
15
|
+
"mediaDirectory": ".",
|
|
16
|
+
"downloadDirectory": ".",
|
|
17
|
+
"contexts": [
|
|
18
|
+
{
|
|
19
|
+
"app": { "name": "chrome", "options": { "headless": false } },
|
|
20
|
+
"platforms": ["mac", "linux"]
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"app": { "name": "chrome", "options": { "headless": true } },
|
|
24
|
+
"platforms": ["windows"]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"runCoverage": {
|
|
30
|
+
"recursive": true,
|
|
31
|
+
"input": ".dev/",
|
|
32
|
+
"output": ".",
|
|
33
|
+
"markup": []
|
|
34
|
+
},
|
|
35
|
+
"suggestTests": {
|
|
36
|
+
"recursive": true,
|
|
37
|
+
"input": ".",
|
|
38
|
+
"output": ".",
|
|
39
|
+
"markup": []
|
|
40
|
+
},
|
|
41
|
+
"telemetry": {
|
|
42
|
+
"send": false
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
# Doc Detective documentation overview
|
|
2
|
-
|
|
3
|
-
[comment]: # (test start {"id":"search-kittens"})
|
|
4
|
-
|
|
5
|
-
[Doc Detective documentation](http://doc-detective.com) is split into a few key sections:
|
|
6
|
-
[comment]: # (step {"action":"goTo", "url":"https://doc-detective.com"})
|
|
7
|
-
|
|
8
|
-
- The landing page discusses what Doc Detective is, what it does, and who might find it useful.
|
|
9
|
-
- [Get started](https://doc-detective.com/docs/get-started/intro) covers how to quickly get up and running with Doc Detective.
|
|
10
|
-
[comment]: # (step {"action":"goTo", "url":"https://doc-detective.com/docs/get-started/intro"})
|
|
11
|
-
- The [references](https://doc-detective.com/docs/references/schemas/typeKeys) detail the various JSON objects that Doc Detective expects for configs, test specifications, tests, actions, and more. Each object schema includes an object description, field definitions, and examples.
|
|
12
|
-
[comment]: # (step {"action":"goTo", "url":"https://doc-detective.com/docs/references/schemas/typeKeys"})
|
|
13
|
-
[comment]: # (step {"action":"find", "selector":"h2#fields", "matchText":"Fields"})
|
|
14
|
-
[comment]: # (step {"action":"find", "selector":"h2#examples", "matchText":"Examples"})
|
|
15
|
-
|
|
1
|
+
# Doc Detective documentation overview
|
|
2
|
+
|
|
3
|
+
[comment]: # (test start {"id":"search-kittens"})
|
|
4
|
+
|
|
5
|
+
[Doc Detective documentation](http://doc-detective.com) is split into a few key sections:
|
|
6
|
+
[comment]: # (step {"action":"goTo", "url":"https://doc-detective.com"})
|
|
7
|
+
|
|
8
|
+
- The landing page discusses what Doc Detective is, what it does, and who might find it useful.
|
|
9
|
+
- [Get started](https://doc-detective.com/docs/get-started/intro) covers how to quickly get up and running with Doc Detective.
|
|
10
|
+
[comment]: # (step {"action":"goTo", "url":"https://doc-detective.com/docs/get-started/intro"})
|
|
11
|
+
- The [references](https://doc-detective.com/docs/references/schemas/typeKeys) detail the various JSON objects that Doc Detective expects for configs, test specifications, tests, actions, and more. Each object schema includes an object description, field definitions, and examples.
|
|
12
|
+
[comment]: # (step {"action":"goTo", "url":"https://doc-detective.com/docs/references/schemas/typeKeys"})
|
|
13
|
+
[comment]: # (step {"action":"find", "selector":"h2#fields", "matchText":"Fields"})
|
|
14
|
+
[comment]: # (step {"action":"find", "selector":"h2#examples", "matchText":"Examples"})
|
|
15
|
+
|
|
16
16
|
[comment]: # (test end)
|
package/test/artifacts/env
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
USER="John Doe"
|
|
2
|
-
JOB="Software Engineer"
|
|
1
|
+
USER="John Doe"
|
|
2
|
+
JOB="Software Engineer"
|
|
3
3
|
SECRET="YOUR_SECRET_KEY"
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "http tests",
|
|
3
|
-
"description": "This is a test collection",
|
|
4
|
-
"tests": [
|
|
5
|
-
{
|
|
6
|
-
"id": "env variables test",
|
|
7
|
-
"description": "These tests will show off how using env files to set variables works in Doc Detective.",
|
|
8
|
-
"steps": [
|
|
9
|
-
{
|
|
10
|
-
"action": "setVariables",
|
|
11
|
-
"path": "env"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"action": "httpRequest",
|
|
15
|
-
"url": "https://reqres.in/api/users",
|
|
16
|
-
"method": "post",
|
|
17
|
-
"requestData": {
|
|
18
|
-
"auth": "$SECRET",
|
|
19
|
-
"name": "$USER",
|
|
20
|
-
"job": "$JOB"
|
|
21
|
-
},
|
|
22
|
-
"responseData": {
|
|
23
|
-
"name": "John Doe",
|
|
24
|
-
"job": "Software Engineer"
|
|
25
|
-
},
|
|
26
|
-
"statusCodes": [200, 201]
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"action": "httpRequest",
|
|
30
|
-
"url": "https://reqres.in/api/users",
|
|
31
|
-
"method": "get",
|
|
32
|
-
"envsFromResponseData": [
|
|
33
|
-
{
|
|
34
|
-
"name": "ID",
|
|
35
|
-
"jqFilter": ".data[0].id"
|
|
36
|
-
}
|
|
37
|
-
],
|
|
38
|
-
"statusCodes": [200, 201]
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"action": "httpRequest",
|
|
42
|
-
"url": "https://reqres.in/api/users/$ID",
|
|
43
|
-
"method": "get",
|
|
44
|
-
"responseData": {
|
|
45
|
-
"data": {
|
|
46
|
-
"first_name": "George",
|
|
47
|
-
"last_name": "Bluth"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
"statusCodes": [200, 201]
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "http tests",
|
|
3
|
+
"description": "This is a test collection",
|
|
4
|
+
"tests": [
|
|
5
|
+
{
|
|
6
|
+
"id": "env variables test",
|
|
7
|
+
"description": "These tests will show off how using env files to set variables works in Doc Detective.",
|
|
8
|
+
"steps": [
|
|
9
|
+
{
|
|
10
|
+
"action": "setVariables",
|
|
11
|
+
"path": "env"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"action": "httpRequest",
|
|
15
|
+
"url": "https://reqres.in/api/users",
|
|
16
|
+
"method": "post",
|
|
17
|
+
"requestData": {
|
|
18
|
+
"auth": "$SECRET",
|
|
19
|
+
"name": "$USER",
|
|
20
|
+
"job": "$JOB"
|
|
21
|
+
},
|
|
22
|
+
"responseData": {
|
|
23
|
+
"name": "John Doe",
|
|
24
|
+
"job": "Software Engineer"
|
|
25
|
+
},
|
|
26
|
+
"statusCodes": [200, 201]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"action": "httpRequest",
|
|
30
|
+
"url": "https://reqres.in/api/users",
|
|
31
|
+
"method": "get",
|
|
32
|
+
"envsFromResponseData": [
|
|
33
|
+
{
|
|
34
|
+
"name": "ID",
|
|
35
|
+
"jqFilter": ".data[0].id"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"statusCodes": [200, 201]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"action": "httpRequest",
|
|
42
|
+
"url": "https://reqres.in/api/users/$ID",
|
|
43
|
+
"method": "get",
|
|
44
|
+
"responseData": {
|
|
45
|
+
"data": {
|
|
46
|
+
"first_name": "George",
|
|
47
|
+
"last_name": "Bluth"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"statusCodes": [200, 201]
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "setup",
|
|
3
|
-
"tests": [
|
|
4
|
-
{
|
|
5
|
-
"steps": [
|
|
6
|
-
{
|
|
7
|
-
"action": "runShell",
|
|
8
|
-
"command": "echo",
|
|
9
|
-
"args": ["setup"],
|
|
10
|
-
"exitCodes": [0],
|
|
11
|
-
"output": "/.*?/",
|
|
12
|
-
"setVariables": [
|
|
13
|
-
{
|
|
14
|
-
"name": "TEST",
|
|
15
|
-
"regex": ".*"
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"action": "runShell",
|
|
21
|
-
"command": "echo",
|
|
22
|
-
"args": ["$TEST"],
|
|
23
|
-
"exitCodes": [0],
|
|
24
|
-
"output": "setup"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "setup",
|
|
3
|
+
"tests": [
|
|
4
|
+
{
|
|
5
|
+
"steps": [
|
|
6
|
+
{
|
|
7
|
+
"action": "runShell",
|
|
8
|
+
"command": "echo",
|
|
9
|
+
"args": ["setup"],
|
|
10
|
+
"exitCodes": [0],
|
|
11
|
+
"output": "/.*?/",
|
|
12
|
+
"setVariables": [
|
|
13
|
+
{
|
|
14
|
+
"name": "TEST",
|
|
15
|
+
"regex": ".*"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"action": "runShell",
|
|
21
|
+
"command": "echo",
|
|
22
|
+
"args": ["$TEST"],
|
|
23
|
+
"exitCodes": [0],
|
|
24
|
+
"output": "setup"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "setup",
|
|
3
|
-
"tests": [
|
|
4
|
-
{
|
|
5
|
-
"steps": [
|
|
6
|
-
{
|
|
7
|
-
"action": "setVariables",
|
|
8
|
-
"path": "
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"action": "runShell",
|
|
12
|
-
"command": "echo",
|
|
13
|
-
"args": ["setup"]
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "setup",
|
|
3
|
+
"tests": [
|
|
4
|
+
{
|
|
5
|
+
"steps": [
|
|
6
|
+
{
|
|
7
|
+
"action": "setVariables",
|
|
8
|
+
"path": "env"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"action": "runShell",
|
|
12
|
+
"command": "echo",
|
|
13
|
+
"args": ["setup"]
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "Do all the things! - Spec",
|
|
3
|
-
"tests": [
|
|
4
|
-
{
|
|
5
|
-
"id": "Do all the things! - Test",
|
|
6
|
-
"description": "This test includes nearly every property across all actions.",
|
|
7
|
-
"setup": "setup.spec.json",
|
|
8
|
-
"cleanup": "cleanup.spec.json",
|
|
9
|
-
"steps": [
|
|
10
|
-
{
|
|
11
|
-
"action": "setVariables",
|
|
12
|
-
"path": "
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"action": "runShell",
|
|
16
|
-
"command": "echo",
|
|
17
|
-
"args": ["$USER"]
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"action": "checkLink",
|
|
21
|
-
"url": "https://www.duckduckgo.com"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"action": "httpRequest",
|
|
25
|
-
"url": "https://reqres.in/api/users",
|
|
26
|
-
"method": "post",
|
|
27
|
-
"requestData": {
|
|
28
|
-
"name": "morpheus",
|
|
29
|
-
"job": "leader"
|
|
30
|
-
},
|
|
31
|
-
"responseData": {
|
|
32
|
-
"name": "morpheus",
|
|
33
|
-
"job": "leader"
|
|
34
|
-
},
|
|
35
|
-
"statusCodes": [200, 201]
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"action": "goTo",
|
|
39
|
-
"url": "https://www.google.com"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"action": "startRecording"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"action": "find",
|
|
46
|
-
"selector": "[title=Search]",
|
|
47
|
-
"timeout": 10000,
|
|
48
|
-
"moveTo": true,
|
|
49
|
-
"click": true,
|
|
50
|
-
"typeKeys": {
|
|
51
|
-
"keys": ["shorthair cat", "$ENTER$"]
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"action": "stopRecording"
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "Do all the things! - Spec",
|
|
3
|
+
"tests": [
|
|
4
|
+
{
|
|
5
|
+
"id": "Do all the things! - Test",
|
|
6
|
+
"description": "This test includes nearly every property across all actions.",
|
|
7
|
+
"setup": "setup.spec.json",
|
|
8
|
+
"cleanup": "cleanup.spec.json",
|
|
9
|
+
"steps": [
|
|
10
|
+
{
|
|
11
|
+
"action": "setVariables",
|
|
12
|
+
"path": "env"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"action": "runShell",
|
|
16
|
+
"command": "echo",
|
|
17
|
+
"args": ["$USER"]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"action": "checkLink",
|
|
21
|
+
"url": "https://www.duckduckgo.com"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"action": "httpRequest",
|
|
25
|
+
"url": "https://reqres.in/api/users",
|
|
26
|
+
"method": "post",
|
|
27
|
+
"requestData": {
|
|
28
|
+
"name": "morpheus",
|
|
29
|
+
"job": "leader"
|
|
30
|
+
},
|
|
31
|
+
"responseData": {
|
|
32
|
+
"name": "morpheus",
|
|
33
|
+
"job": "leader"
|
|
34
|
+
},
|
|
35
|
+
"statusCodes": [200, 201]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"action": "goTo",
|
|
39
|
+
"url": "https://www.google.com"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"action": "startRecording"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"action": "find",
|
|
46
|
+
"selector": "[title=Search]",
|
|
47
|
+
"timeout": 10000,
|
|
48
|
+
"moveTo": true,
|
|
49
|
+
"click": true,
|
|
50
|
+
"typeKeys": {
|
|
51
|
+
"keys": ["shorthair cat", "$ENTER$"]
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"action": "stopRecording"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
package/test/runTests.test.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
const { spawnCommand } = require(
|
|
3
|
-
const assert = require("assert").strict;
|
|
4
|
-
const fs = require("fs");
|
|
5
|
-
const artifactPath = path.resolve(__dirname, "./artifacts");
|
|
6
|
-
const outputFile = path.resolve(`${artifactPath}/testResults.json`);
|
|
7
|
-
|
|
8
|
-
describe("Run tests
|
|
9
|
-
// Set indefinite timeout
|
|
10
|
-
this.timeout(0);
|
|
11
|
-
it("All specs pass", async () => {
|
|
12
|
-
await spawnCommand(
|
|
13
|
-
`node ./src/index.js
|
|
14
|
-
);
|
|
15
|
-
// Wait until the file is written
|
|
16
|
-
while (!fs.existsSync(outputFile)) {}
|
|
17
|
-
const result = require(outputFile);
|
|
18
|
-
console.log(JSON.stringify(result, null, 2));
|
|
19
|
-
fs.unlinkSync(outputFile);
|
|
20
|
-
assert.equal(result.summary.specs.fail, 0);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const { spawnCommand } = require("../src/utils");
|
|
3
|
+
const assert = require("assert").strict;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const artifactPath = path.resolve(__dirname, "./artifacts");
|
|
6
|
+
const outputFile = path.resolve(`${artifactPath}/testResults.json`);
|
|
7
|
+
|
|
8
|
+
describe("Run tests successfully", function () {
|
|
9
|
+
// Set indefinite timeout
|
|
10
|
+
this.timeout(0);
|
|
11
|
+
it("All specs pass", async () => {
|
|
12
|
+
await spawnCommand(
|
|
13
|
+
`node ./src/index.js -c ${artifactPath}/config.json -i ${artifactPath} -o ${outputFile}`
|
|
14
|
+
);
|
|
15
|
+
// Wait until the file is written
|
|
16
|
+
while (!fs.existsSync(outputFile)) {}
|
|
17
|
+
const result = require(outputFile);
|
|
18
|
+
console.log(JSON.stringify(result, null, 2));
|
|
19
|
+
fs.unlinkSync(outputFile);
|
|
20
|
+
assert.equal(result.summary.specs.fail, 0);
|
|
21
|
+
});
|
|
22
|
+
});
|
package/test/test-config.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
{
|
|
2
|
-
"input": ".",
|
|
3
|
-
"output": ".",
|
|
4
|
-
"logLevel": "silent",
|
|
5
|
-
"recursive": true,
|
|
6
|
-
"runTests": {
|
|
7
|
-
"setup": ".",
|
|
8
|
-
"cleanup": "."
|
|
9
|
-
},
|
|
10
|
-
"telemetry": {
|
|
11
|
-
"send": false
|
|
12
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"input": ".",
|
|
3
|
+
"output": ".",
|
|
4
|
+
"logLevel": "silent",
|
|
5
|
+
"recursive": true,
|
|
6
|
+
"runTests": {
|
|
7
|
+
"setup": ".",
|
|
8
|
+
"cleanup": "."
|
|
9
|
+
},
|
|
10
|
+
"telemetry": {
|
|
11
|
+
"send": false
|
|
12
|
+
}
|
|
13
13
|
}
|