Skip to content

Commit

Permalink
chore(api): generate docs + types
Browse files Browse the repository at this point in the history
  • Loading branch information
jwerle committed Mar 9, 2024
1 parent 2c73c99 commit ddaf509
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 42 deletions.
82 changes: 43 additions & 39 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,7 @@ Returns an object describing the memory usage of the Node.js process measured in
### [`constructor(name, fn, runner)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L76)
### [`constructor(name, fn, runner)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L127)



Expand All @@ -1918,15 +1918,15 @@ Returns an object describing the memory usage of the Node.js process measured in
| fn | TestFn | | false | |
| runner | TestRunner | | false | |

### [`comment(msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L127)
### [`comment(msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L138)



| Argument | Type | Default | Optional | Description |
| :--- | :--- | :---: | :---: | :--- |
| msg | string | | false | |

### [`plan(n)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L137)
### [`plan(n)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L148)

Plan the number of assertions.

Expand All @@ -1935,7 +1935,7 @@ Plan the number of assertions.
| :--- | :--- | :---: | :---: | :--- |
| n | number | | false | |

### [`deepEqual(actual, expected, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L148)
### [`deepEqual(actual, expected, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L159)



Expand All @@ -1945,7 +1945,7 @@ Plan the number of assertions.
| expected | T | | false | |
| msg | string | | true | |

### [`notDeepEqual(actual, expected, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L163)
### [`notDeepEqual(actual, expected, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L174)



Expand All @@ -1955,7 +1955,7 @@ Plan the number of assertions.
| expected | T | | false | |
| msg | string | | true | |

### [`equal(actual, expected, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L178)
### [`equal(actual, expected, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L189)



Expand All @@ -1965,7 +1965,7 @@ Plan the number of assertions.
| expected | T | | false | |
| msg | string | | true | |

### [`notEqual(actual, expected, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L193)
### [`notEqual(actual, expected, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L204)



Expand All @@ -1975,15 +1975,15 @@ Plan the number of assertions.
| expected | unknown | | false | |
| msg | string | | true | |

### [`fail(msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L206)
### [`fail(msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L217)



| Argument | Type | Default | Optional | Description |
| :--- | :--- | :---: | :---: | :--- |
| msg | string | | true | |

### [`ok(actual, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L219)
### [`ok(actual, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L230)



Expand All @@ -1992,15 +1992,15 @@ Plan the number of assertions.
| actual | unknown | | false | |
| msg | string | | true | |

### [`pass(msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L231)
### [`pass(msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L242)



| Argument | Type | Default | Optional | Description |
| :--- | :--- | :---: | :---: | :--- |
| msg | string | | true | |

### [`ifError(err, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L240)
### [`ifError(err, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L251)



Expand All @@ -2009,7 +2009,7 @@ Plan the number of assertions.
| err | Error \| null \| undefined | | false | |
| msg | string | | true | |

### [`throws(fn, expected, message)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L253)
### [`throws(fn, expected, message)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L264)



Expand All @@ -2019,7 +2019,7 @@ Plan the number of assertions.
| expected | RegExp \| any | | true | |
| message | string | | true | |

### [`sleep(ms, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L302)
### [`sleep(ms, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L313)

Sleep for ms with an optional msg

Expand All @@ -2037,7 +2037,7 @@ Sleep for ms with an optional msg
| :--- | :--- | :--- |
| Not specified | Promise<void> | |

### [`requestAnimationFrame(msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L320)
### [`requestAnimationFrame(msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L331)

Request animation frame with an optional msg. Falls back to a 0ms setTimeout when
tests are run headlessly.
Expand All @@ -2055,7 +2055,7 @@ Request animation frame with an optional msg. Falls back to a 0ms setTimeout whe
| :--- | :--- | :--- |
| Not specified | Promise<void> | |

### [`click(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L342)
### [`click(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L354)

Dispatch the `click`` method on an element specified by selector.

Expand All @@ -2073,7 +2073,7 @@ Dispatch the `click`` method on an element specified by selector.
| :--- | :--- | :--- |
| Not specified | Promise<void> | |

### [`eventClick(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L364)
### [`eventClick(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L376)

Dispatch the click window.MouseEvent on an element specified by selector.

Expand All @@ -2091,7 +2091,7 @@ Dispatch the click window.MouseEvent on an element specified by selector.
| :--- | :--- | :--- |
| Not specified | Promise<void> | |

### [`dispatchEvent(event, target, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L392)
### [`dispatchEvent(event, target, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L404)

Dispatch an event on the target.

Expand All @@ -2110,7 +2110,7 @@ Dispatch an event on the target.
| :--- | :--- | :--- |
| Not specified | Promise<void> | |

### [`focus(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L412)
### [`focus(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L424)

Call the focus method on element specified by selector.

Expand All @@ -2128,7 +2128,7 @@ Call the focus method on element specified by selector.
| :--- | :--- | :--- |
| Not specified | Promise<void> | |

### [`blur(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L433)
### [`blur(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L445)

Call the blur method on element specified by selector.

Expand All @@ -2146,7 +2146,7 @@ Call the blur method on element specified by selector.
| :--- | :--- | :--- |
| Not specified | Promise<void> | |

### [`type(selector, str, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L455)
### [`type(selector, str, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L467)

Consecutively set the str value of the element specified by selector to simulate typing.

Expand All @@ -2165,7 +2165,7 @@ Consecutively set the str value of the element specified by selector to simulate
| :--- | :--- | :--- |
| Not specified | Promise<void> | |

### [`appendChild(parentSelector, el, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L487)
### [`appendChild(parentSelector, el, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L499)

appendChild an element el to a parent selector element.

Expand All @@ -2185,7 +2185,7 @@ appendChild an element el to a parent selector element.
| :--- | :--- | :--- |
| Not specified | Promise<void> | |

### [`removeElement(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L507)
### [`removeElement(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L519)

Remove an element from the DOM.

Expand All @@ -2203,7 +2203,7 @@ Remove an element from the DOM.
| :--- | :--- | :--- |
| Not specified | Promise<void> | |

### [`elementVisible(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L526)
### [`elementVisible(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L538)

Test if an element is visible

Expand All @@ -2221,7 +2221,7 @@ Test if an element is visible
| :--- | :--- | :--- |
| Not specified | Promise<void> | |

### [`elementInvisible(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L547)
### [`elementInvisible(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L559)

Test if an element is invisible

Expand All @@ -2239,7 +2239,7 @@ Test if an element is invisible
| :--- | :--- | :--- |
| Not specified | Promise<void> | |

### [`waitFor(querySelectorOrFn, opts, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L571)
### [`waitFor(querySelectorOrFn, opts, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L583)

Test if an element is invisible

Expand All @@ -2260,7 +2260,7 @@ Test if an element is invisible
| :--- | :--- | :--- |
| Not specified | Promise<HTMLElement \| Element \| void> | |
### [`waitForText(selector, opts, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L633)
### [`waitForText(selector, opts, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L645)
Test if an element is invisible
Expand Down Expand Up @@ -2290,7 +2290,7 @@ Test if an element is invisible
| :--- | :--- | :--- |
| Not specified | Promise<HTMLElement \| Element \| void> | |
### [`querySelector(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L670)
### [`querySelector(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L682)
Run a querySelector as an assert and also get the results
Expand All @@ -2308,7 +2308,7 @@ Run a querySelector as an assert and also get the results
| :--- | :--- | :--- |
| Not specified | HTMLElement \| Element | |
### [`querySelectorAll(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L689)
### [`querySelectorAll(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L701)
Run a querySelectorAll as an assert and also get the results
Expand All @@ -2326,7 +2326,7 @@ Run a querySelectorAll as an assert and also get the results
| :--- | :--- | :--- |
| Not specified | Array<HTMLElement \| Element> | |
### [`getComputedStyle(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L718)
### [`getComputedStyle(selector, msg)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L730)
Retrieves the computed styles for a given element.
Expand All @@ -2351,33 +2351,37 @@ Retrieves the computed styles for a given element.
| :--- | :--- | :--- |
| Not specified | CSSStyleDeclaration | The computed styles of the element. |
### [`run()`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L815)
### [`run()`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L827)
pass: number,
fail: number
}>}
## [TestRunner](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L896)
## [TestRunner](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L908)
### [`constructor(report)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L901)
### [`constructor(report)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L959)



| Argument | Type | Default | Optional | Description |
| :--- | :--- | :---: | :---: | :--- |
| report | (lines: string) => void | | true | |

### [`nextId()`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L953)
### [`nextId()`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L968)



| Return Value | Type | Description |
| :--- | :--- | :--- |
| Not specified | string | |

### [`add(name, fn, only)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L963)
### [`length()`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L975)



### [`add(name, fn, only)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L985)



Expand All @@ -2387,23 +2391,23 @@ Retrieves the computed styles for a given element.
| fn | TestFn | | false | |
| only | boolean | | false | |

### [`run()`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L985)
### [`run()`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1007)



| Return Value | Type | Description |
| :--- | :--- | :--- |
| Not specified | Promise<void> | |

### [`onFinish())`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1032)
### [`onFinish())`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1054)



| Argument | Type | Default | Optional | Description |
| :--- | :--- | :---: | :---: | :--- |
| ) | (result: { total: number, success: number, fail: number | > void} callback | false | |

## [`only(name, fn)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1060)
## [`only(name, fn)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1082)



Expand All @@ -2412,7 +2416,7 @@ Retrieves the computed styles for a given element.
| name | string | | false | |
| fn | TestFn | | true | |

## [`skip(_name, _fn)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1070)
## [`skip(_name, _fn)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1092)



Expand All @@ -2421,7 +2425,7 @@ Retrieves the computed styles for a given element.
| _name | string | | false | |
| _fn | TestFn | | true | |

## [`setStrict(strict)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1076)
## [`setStrict(strict)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1098)



Expand Down
10 changes: 7 additions & 3 deletions api/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7722,14 +7722,18 @@ declare module "socket:test/index" {
*/
strict: boolean;
/**
* @type {function | void}
* @ignore
*/
* @type {function | void}
* @ignore
*/
_onFinishCallback: Function | void;
/**
* @returns {string}
*/
nextId(): string;
/**
* @type {number}
*/
get length(): number;
/**
* @param {string} name
* @param {TestFn} fn
Expand Down

0 comments on commit ddaf509

Please sign in to comment.