doc-detective 2.9.0-dev.2 → 2.9.2
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/docker-image.yml +19 -19
- package/.github/workflows/electron-publish.yml +17 -17
- package/.github/workflows/npm-publish.yml +67 -0
- package/.github/workflows/npm-test.yaml +48 -50
- package/CONTRIBUTIONS.md +27 -0
- package/LICENSE +20 -20
- package/README.md +117 -112
- package/dev/dev.spec.json +62 -62
- package/dev/index.js +5 -5
- package/package.json +44 -44
- package/samples/config.json +89 -89
- package/samples/doc-content-inline-tests.md +27 -27
- package/samples/doc-content.md +8 -8
- package/samples/tests.spec.json +70 -70
- package/samples/variables.env +4 -4
- package/src/index.js +43 -43
- package/src/utils.js +156 -156
- package/test/artifacts/config.json +43 -46
- package/test/artifacts/doc-content.md +17 -17
- package/test/artifacts/test.spec.json +58 -71
- package/test/runCoverage.test.js +18 -18
- package/test/runTests.test.js +22 -22
- package/test/test-config.json +9 -9
- package/test/test-results.json +124 -124
- package/test/utils.test.js +204 -204
package/.github/FUNDING.yml
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# These are supported funding model platforms
|
|
2
|
-
|
|
3
|
-
github: [doc-detective] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
|
4
|
-
patreon: # Replace with a single Patreon username
|
|
5
|
-
open_collective: doc-detective # Replace with a single Open Collective username
|
|
6
|
-
ko_fi: # Replace with a single Ko-fi username
|
|
7
|
-
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
|
8
|
-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
9
|
-
liberapay: # Replace with a single Liberapay username
|
|
10
|
-
issuehunt: # Replace with a single IssueHunt username
|
|
11
|
-
otechie: # Replace with a single Otechie username
|
|
12
|
-
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
|
13
|
-
polar: # Replace with a single Polar username
|
|
14
|
-
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
|
1
|
+
# These are supported funding model platforms
|
|
2
|
+
|
|
3
|
+
github: [doc-detective] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
|
4
|
+
patreon: # Replace with a single Patreon username
|
|
5
|
+
open_collective: doc-detective # Replace with a single Open Collective username
|
|
6
|
+
ko_fi: # Replace with a single Ko-fi username
|
|
7
|
+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
|
8
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
9
|
+
liberapay: # Replace with a single Liberapay username
|
|
10
|
+
issuehunt: # Replace with a single IssueHunt username
|
|
11
|
+
otechie: # Replace with a single Otechie username
|
|
12
|
+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
|
13
|
+
polar: # Replace with a single Polar username
|
|
14
|
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
package/.github/dependabot.yml
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
-
# package ecosystems to update and where the package manifests are located.
|
|
3
|
-
# Please see the documentation for all configuration options:
|
|
4
|
-
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
-
|
|
6
|
-
version: 2
|
|
7
|
-
updates:
|
|
8
|
-
- package-ecosystem: "npm" # See documentation for possible values
|
|
9
|
-
directory: "/" # Location of package manifests
|
|
10
|
-
schedule:
|
|
11
|
-
interval: "weekly"
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
- package-ecosystem: "npm" # See documentation for possible values
|
|
9
|
+
directory: "/" # Location of package manifests
|
|
10
|
+
schedule:
|
|
11
|
+
interval: "weekly"
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
name: Docker Image CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ "main" ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ "main" ]
|
|
8
|
-
workflow_dispatch:
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
|
|
12
|
-
build:
|
|
13
|
-
|
|
14
|
-
runs-on: macos-latest
|
|
15
|
-
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v3
|
|
18
|
-
- name: Build the Docker image
|
|
19
|
-
run: npm run docker:build:multiarch
|
|
1
|
+
name: Docker Image CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "main" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ "main" ]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
|
|
12
|
+
build:
|
|
13
|
+
|
|
14
|
+
runs-on: macos-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v3
|
|
18
|
+
- name: Build the Docker image
|
|
19
|
+
run: npm run docker:build:multiarch
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
name: Build and publish Electron bundles
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
# push:
|
|
5
|
-
# branches:
|
|
6
|
-
# - main
|
|
7
|
-
workflow_dispatch:
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
build:
|
|
11
|
-
runs-on: macos-latest
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v3
|
|
14
|
-
- uses: actions/setup-node@v3
|
|
15
|
-
- run: cd frontend && npm i
|
|
16
|
-
- run: cd ../electron && npm i
|
|
17
|
-
- run: npm run publish
|
|
1
|
+
name: Build and publish Electron bundles
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
# push:
|
|
5
|
+
# branches:
|
|
6
|
+
# - main
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: macos-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v3
|
|
14
|
+
- uses: actions/setup-node@v3
|
|
15
|
+
- run: cd frontend && npm i
|
|
16
|
+
- run: cd ../electron && npm i
|
|
17
|
+
- run: npm run publish
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Publish NPM package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [created]
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ${{ matrix.os }}
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
os:
|
|
17
|
+
- ubuntu-latest
|
|
18
|
+
- windows-latest
|
|
19
|
+
- macos-latest
|
|
20
|
+
node:
|
|
21
|
+
- 18
|
|
22
|
+
- 20
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v3
|
|
25
|
+
|
|
26
|
+
- uses: actions/setup-node@v3
|
|
27
|
+
with:
|
|
28
|
+
node-version: ${{ matrix.node }}
|
|
29
|
+
|
|
30
|
+
- name: Cache node_modules
|
|
31
|
+
uses: actions/cache@v3
|
|
32
|
+
with:
|
|
33
|
+
# Cache key uses the contents of `package-lock.json` to identify unique cache
|
|
34
|
+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
35
|
+
restore-keys: |
|
|
36
|
+
${{ runner.OS }}-node-
|
|
37
|
+
path: |
|
|
38
|
+
node_modules
|
|
39
|
+
|
|
40
|
+
- run: npm ci
|
|
41
|
+
|
|
42
|
+
- run: npm test
|
|
43
|
+
|
|
44
|
+
publish-npm:
|
|
45
|
+
needs: build
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v3
|
|
49
|
+
|
|
50
|
+
- uses: actions/setup-node@v3
|
|
51
|
+
with:
|
|
52
|
+
registry-url: https://registry.npmjs.org/
|
|
53
|
+
|
|
54
|
+
- name: Cache node_modules
|
|
55
|
+
uses: actions/cache@v3
|
|
56
|
+
with:
|
|
57
|
+
# Cache key uses the contents of `package-lock.json` to identify unique cache
|
|
58
|
+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
59
|
+
restore-keys: |
|
|
60
|
+
${{ runner.OS }}-node-
|
|
61
|
+
path: |
|
|
62
|
+
node_modules
|
|
63
|
+
|
|
64
|
+
- run: npm ci
|
|
65
|
+
- run: npm publish
|
|
66
|
+
env:
|
|
67
|
+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
|
@@ -1,50 +1,48 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
- run: npm
|
|
49
|
-
|
|
50
|
-
- run: npm test
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Run tests
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
pull_request:
|
|
11
|
+
types:
|
|
12
|
+
- opened
|
|
13
|
+
- reopened
|
|
14
|
+
- synchronize
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ${{ matrix.os }}
|
|
20
|
+
strategy:
|
|
21
|
+
matrix:
|
|
22
|
+
os:
|
|
23
|
+
- ubuntu-latest
|
|
24
|
+
- windows-latest
|
|
25
|
+
- macos-latest
|
|
26
|
+
node:
|
|
27
|
+
- 18
|
|
28
|
+
- 20
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v3
|
|
31
|
+
|
|
32
|
+
- uses: actions/setup-node@v3
|
|
33
|
+
with:
|
|
34
|
+
node-version: ${{ matrix.node }}
|
|
35
|
+
|
|
36
|
+
- name: Cache node_modules
|
|
37
|
+
uses: actions/cache@v3
|
|
38
|
+
with:
|
|
39
|
+
# Cache key uses the contents of `package-lock.json` to identify unique cache
|
|
40
|
+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
41
|
+
restore-keys: |
|
|
42
|
+
${{ runner.OS }}-node-
|
|
43
|
+
path: |
|
|
44
|
+
node_modules
|
|
45
|
+
|
|
46
|
+
- run: npm ci
|
|
47
|
+
|
|
48
|
+
- run: npm test
|
package/CONTRIBUTIONS.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# How to contribute
|
|
2
|
+
|
|
3
|
+
`doc-detective` welcomes contributions of all sorts (as do all Doc Detective projects). If you can't contribute code, you can still help by reporting issues, suggesting new features, improving the documentation, or sponsoring the project. Please follow the guidelines below.
|
|
4
|
+
|
|
5
|
+
## Reporting issues
|
|
6
|
+
|
|
7
|
+
If you find a bug, report it on the [GitHub issue tracker](https://github.com/doc-detective/doc-detective/issues).
|
|
8
|
+
|
|
9
|
+
## Contributing code
|
|
10
|
+
|
|
11
|
+
To contribute code,
|
|
12
|
+
|
|
13
|
+
1. Fork the project.
|
|
14
|
+
2. Create a new branch.
|
|
15
|
+
3. Make your changes.
|
|
16
|
+
4. Submit a pull request to the `rc` (release candidate) branch.
|
|
17
|
+
5. Wait for your pull request to be reviewed.
|
|
18
|
+
6. Make any necessary changes to your pull request.
|
|
19
|
+
7. Your pull request will be merged once it has been reviewed and approved.
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
By contributing to `doc-detective`, you agree that your contributions will be licensed under the [MIT license](https://github.com/doc-detective/doc-detective/blob/main/LICENCE).
|
|
24
|
+
|
|
25
|
+
## Thank you
|
|
26
|
+
|
|
27
|
+
Thank you for your contributions! We appreciate your help in making the project better.
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
The MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021- Manny Silva
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021- Manny Silva
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
21
|
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,112 +1,117 @@
|
|
|
1
|
-
# <img src="https://github.com/doc-detective/doc-detective/blob/main/icon.png" width=50 style="vertical-align:middle;margin-bottom:7px"/> Doc Detective: The Documentation Testing Framework
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-
[](https://discord.gg/2M7wXEThfF)
|
|
5
|
-
[](https://doc-detective.com)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
- [Doc Detective
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
1
|
+
# <img src="https://github.com/doc-detective/doc-detective/blob/main/icon.png" width=50 style="vertical-align:middle;margin-bottom:7px"/> Doc Detective: The Documentation Testing Framework
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
[](https://discord.gg/2M7wXEThfF)
|
|
5
|
+
[](https://doc-detective.com)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Doc Detective is an open-source documentation testing framework that makes it easy to keep your docs accurate and up-to-date. You write low-code (soon no-code) tests, and Doc Detective runs them directly against your product to make sure your docs match your user experience. Whether it’s a UI-based process or a series of API calls, Doc Detective can help you find doc bugs before your users do.
|
|
9
|
+
|
|
10
|
+
Doc Detective ingests test specifications and text files, parses them for testable actions, then executes those actions in a browser. The results (PASS/FAIL and context) are output as a JSON object so that other pieces of infrastructure can parse and manipulate them as needed.
|
|
11
|
+
|
|
12
|
+
This project handles test parsing and web-based UI testing--it doesn't support results reporting or notifications. This framework is a part of testing infrastructures and needs to be complemented by other components.
|
|
13
|
+
|
|
14
|
+
## Components
|
|
15
|
+
|
|
16
|
+
Doc Detective has multiple components to integrate with your workflows as you need it to:
|
|
17
|
+
|
|
18
|
+
- Doc Detective (this repo): A standalone tool that enables testing without a separate Node project.
|
|
19
|
+
- [Doc Detective Core](https://github.com/doc-detective/doc-detective-core): An NPM package that provides the testing functionality.
|
|
20
|
+
- [Doc Detective Docs](https://github.com/doc-detective/doc-detective.github.io): Source files for [doc-detective.com](https://doc-detective.com).
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
> The following sections cover running Doc Detective as a CLI tool. To use Doc Detective via another interface (like as an NPM package), [see the docs](https://doc-detective.com).
|
|
25
|
+
|
|
26
|
+
You can run Doc Detective as a CLI tool with Node:
|
|
27
|
+
|
|
28
|
+
0. Install prerequisites:
|
|
29
|
+
|
|
30
|
+
- [Node.js](https://nodejs.org/) (tested on 18.16.0)
|
|
31
|
+
|
|
32
|
+
1. In a terminal, clone the repo and install dependencies:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
git clone https://github.com/doc-detective/doc-detective.git
|
|
36
|
+
cd doc-detective
|
|
37
|
+
npm install
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Run tests
|
|
41
|
+
|
|
42
|
+
To run your tests, use the `runTests` command and specify your test file with the `--input` argument. For example, to run tests in a file named `doc-content.md` in the `samples` directory (like in this repo!), run the following command:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm run runTests -- --input ./samples/doc-content.md
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
To customize your test, file type, and directory options, create a [`config.json`](https://doc-detective.com/reference/schemas/config.html) file and reference it with the `--config` argument.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm run runTests -- --config ./samples/config.json
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
You can override `config.json` options with command-line arguments. For example, to run tests in a file named `tests.spec.json` in the `samples` directory, run the following command:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm run runTests -- --config ./samples/config.json --input ./samples/tests.spec.json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
To see all available options, use the `--help` argument:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm run runTests -- --help
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Check your test coverage
|
|
67
|
+
|
|
68
|
+
You can check the test coverage of your documentation source files with the `runCoverage` command, specifying the source file or directory of source files with the `--input` argument. Doc Detective identifies potential areas of test coverage with file-format-specific regex, and supports CommonMark syntax natively. If you want to test coverage of a file with different syntax, update your the `fileTypes` object of your [`config.json`](https://doc-detective.com/reference/schemas/config.html) file accordingly.
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm run runCoverage -- --config ./samples/config.json --input ./samples/doc-content.md
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
To see all available options, use the `--help` argument:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm run runCoverage -- --help
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Suggest tests for coverage gaps (Experimental)
|
|
82
|
+
|
|
83
|
+
The `suggestTests` command provides experimental support for suggesting tests for coverage gaps identifying during test coverage analysis. However, the `suggestTests` command is highly experimental, so usage of the command is left as an exercise for the user.
|
|
84
|
+
|
|
85
|
+
## Concepts
|
|
86
|
+
|
|
87
|
+
- [**Test specification**](https://doc-detective.com/reference/schemas/specification.html): A group of tests to run in one or more contexts. Conceptually parallel to a document.
|
|
88
|
+
- [**Test**](https://doc-detective.com/reference/schemas/test.html): A sequence of steps to perform. Conceptually parallel to a procedure.
|
|
89
|
+
- **Step**: A portion of a test that includes a single action. Conceptually parallel to a step in a procedure.
|
|
90
|
+
- **Action**: The task a performed in a step. Doc Detective supports a variety of actions:
|
|
91
|
+
- [**checkLink**](https://doc-detective.com/reference/schemas/checkLink.html): Check if a URL returns an acceptable status code from a GET request.
|
|
92
|
+
- [**find**](https://doc-detective.com/reference/schemas/find.html): Check if an element exists with the specified selector.
|
|
93
|
+
- [**goTo**](https://doc-detective.com/reference/schemas/goTo.html): Navigate to a specified URL.
|
|
94
|
+
- [**httpRequest**](https://doc-detective.com/reference/schemas/httpRequest.html): Perform a generic HTTP request, for example to an API.
|
|
95
|
+
- [**runShell**](https://doc-detective.com/reference/schemas/runShell.html): Perform a native shell command.
|
|
96
|
+
- [**saveScreenshot**](https://doc-detective.com/reference/schemas/saveScreenshot.html): Take a screenshot in PNG format.
|
|
97
|
+
- [**setVariables**](https://doc-detective.com/reference/schemas/setVariables.html): Load environment variables from a `.env` file.
|
|
98
|
+
- [**startRecording**](https://doc-detective.com/reference/schemas/startRecording.html) and [**stopRecording**](https://doc-detective.com/reference/schemas/stopRecording.html): Capture a video of test execution.
|
|
99
|
+
- [**typeKeys**](https://doc-detective.com/reference/schemas/typeKeys.html): Type keys. To type special keys, begin and end the string with `$` and use the special key’s enum. For example, to type the Escape key, enter `$ESCAPE$`.
|
|
100
|
+
- [**wait**](https://doc-detective.com/reference/schemas/wait.html): Pause before performing the next action.
|
|
101
|
+
- [**Context**](https://doc-detective.com/reference/schemas/context.html): An application and platforms that support the tests.
|
|
102
|
+
|
|
103
|
+
## Roadmap
|
|
104
|
+
|
|
105
|
+
Future updates may include support for the following items:
|
|
106
|
+
|
|
107
|
+
- Apps: iOS Safari, Android Chrome, native Windows, native macOS, native Linux
|
|
108
|
+
- Platforms: iOS, Android
|
|
109
|
+
- Commands: `suggestTests` stable release
|
|
110
|
+
|
|
111
|
+
## Contributions
|
|
112
|
+
|
|
113
|
+
Looking to help out? See our [contributions guide](https://github.com/doc-detective/doc-detective/blob/main/CONTRIBUTIONS.md) for more info. If you can't contribute code, you can still help by reporting issues, suggesting new features, improving the documentation, or sponsoring the project.
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
This project uses the [MIT license](https://github.com/doc-detective/doc-detective/blob/master/LICENSE).
|