Skip to content

Commit 1b2b198

Browse files
committed
Automatically generate documentation and upload it
Generate HTML documentation and upload it to https://boxine.github.io/pintf/ . Currently, the content of the documentation is still sparse. Only export functions with JSDoc comments, because without `--excludeNotDocument`, [tsdoc will export _everything_](TypeStrong/typedoc#639), including stuff like `const assert = require('assert');`.
1 parent af735e7 commit 1b2b198

File tree

8 files changed

+235
-4
lines changed

8 files changed

+235
-4
lines changed

.github/workflows/docs.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Generate documentation
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- upload-docs
7+
8+
jobs:
9+
doc:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
persist-credentials: false
16+
17+
- name: Build documentation
18+
run: |
19+
npm install
20+
make doc
21+
22+
- name: Upload to gh-pages
23+
uses: peaceiris/actions-gh-pages@v3
24+
with:
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
publish_dir: ./doc

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
node_modules
22
results.*
33
screenshots
4+
doc/
45

56
# Editor
67
.vscode/

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ lint:
66
test:
77
@npm run test --silent
88

9+
doc: *.js tsconfig.json
10+
./node_modules/.bin/typedoc --out doc --noEmit --excludeNotExported --excludeNotDocumented
11+
912
lockserver-dev:
1013
node_modules/.bin/nodemon lockserver/lockserver.js
1114

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ module.exports = {
9494

9595
Note that while the above example tests a webpage with [puppeteer](https://github.com/GoogleChrome/puppeteer) and uses pintf's has native support for HTTP requests (in `net_utils`) and email sending (in `email`), tests can be anything – they just have to fail the promise if the test fails.
9696

97+
Have a look in the [API documentation](https://boxine.github.io/pintf/index.html) for various helper functions.
98+
9799
## Configuration
98100

99101
pintf is designed to be run against different configurations, e.g. local/dev/stage/prod. Create JSON files in the `config` subdirectory for each environment. You can also add a programatic configuration by passing a function `defaultConfig` to `pintf.main`; see [pintf's own run](run) for an example.

browser_utils.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
'use strict';
2+
/**
3+
* Browser functions, based upon puppeteer.
4+
* These functions extend [the puppeteer API](https://github.com/puppeteer/puppeteer/blob/master/docs/api.md).
5+
* @packageDocumentation
6+
*/
27

38
const assert = require('assert');
49
const fs = require('fs');
@@ -11,10 +16,10 @@ const {assertAsyncEventually, wait, remove} = require('./utils');
1116
let tmp_home;
1217

1318
/**
14-
* Launch a new page
15-
* @param {*} config
16-
* @param {string[]} [chrome_args]
17-
* @returns {import('puppeteer').Page}
19+
* Launch a new browser, with a new page (=Tab)
20+
* @param {*} config The pintf configuration
21+
* @param {string[]} [chrome_args] Additional arguments for Chrome (optional)
22+
* @returns {import('puppeteer').Page} The puppeteer page handle.
1823
*/
1924
async function newPage(config, chrome_args=[]) {
2025
let puppeteer;

package-lock.json

Lines changed: 192 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"nodemon": "^1.18.11",
2929
"puppeteer": "^2.1.1",
3030
"rimraf": "^3.0.2",
31+
"typedoc": "^0.17.3",
3132
"typescript": "^3.8.3"
3233
},
3334
"peerDependencies": {

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"compilerOptions": {
33
"module": "CommonJS",
44
"allowJs": true,
5+
"alwaysStrict": true,
56
"declaration": true,
67
"emitDeclarationOnly": true,
78
},

0 commit comments

Comments
 (0)