Skip to content

Commit ade26c3

Browse files
committed
Merge branch 'alpha-docs' into alpha
2 parents d557c14 + 0b39de8 commit ade26c3

File tree

9 files changed

+72
-11
lines changed

9 files changed

+72
-11
lines changed

.all-contributorsrc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,17 @@
2020
"doc",
2121
"maintenance"
2222
]
23+
},
24+
{
25+
"login": "SerkanSipahi",
26+
"name": "Bitcollage",
27+
"avatar_url": "https://avatars.githubusercontent.com/u/1880749?v=4",
28+
"profile": "https://www.linkedin.com/in/serkan-sipahi-59b20081/",
29+
"contributions": [
30+
"doc"
31+
]
2332
}
2433
],
2534
"repoHost": "https://github.com",
2635
"commitConvention": "none"
27-
}
36+
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ practices.</p>
2121
[![version](https://img.shields.io/npm/v/cli-testing-library?style=flat-square)](https://www.npmjs.com/package/cli-testing-library)
2222
[![downloads](https://img.shields.io/npm/dw/cli-testing-library?style=flat-square)](https://www.npmjs.com/package/cli-testing-library)
2323
[![MIT License](https://img.shields.io/npm/l/cli-testing-library?style=flat-square)](./LICENSE)
24-
[![All Contributors](https://img.shields.io/badge/all_contributors-7-blue.svg?style=flat-square)](#contributors)
2524
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](makeapullrequest.com)
2625
[![Code of Conduct](https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square)](./CODE_OF_CONDUCT.md)
2726

2827
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
29-
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
28+
[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)
3029
<!-- ALL-CONTRIBUTORS-BADGE:END -->
3130

3231
[![Watch on GitHub](https://img.shields.io/github/watchers/crutchcorn/cli-testing-library.svg?style=social)](https://github.com/crutchcorn/cli-testing-library/watchers)
@@ -109,6 +108,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
109108
<table>
110109
<tr>
111110
<td align="center"><a href="https://crutchcorn.dev/"><img src="https://avatars.githubusercontent.com/u/9100169?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Corbin Crutchley</b></sub></a><br /><a href="https://github.com/crutchcorn/cli-testing-library/commits?author=crutchcorn" title="Code">💻</a> <a href="https://github.com/crutchcorn/cli-testing-library/commits?author=crutchcorn" title="Documentation">📖</a> <a href="#maintenance-crutchcorn" title="Maintenance">🚧</a></td>
111+
<td align="center"><a href="https://www.linkedin.com/in/serkan-sipahi-59b20081/"><img src="https://avatars.githubusercontent.com/u/1880749?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Bitcollage</b></sub></a><br /><a href="https://github.com/crutchcorn/cli-testing-library/commits?author=SerkanSipahi" title="Documentation">📖</a></td>
112112
</tr>
113113
</table>
114114

docs/api.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,27 @@ interface TestInstance {
216216
This method acts as the terminal `clear` command might on most systems. It
217217
allows you to clear out the buffers for `stdoutArr` and `stderrArr` - even in
218218
the middle of processing - in order to do more narrowed queries.
219+
220+
# `cleanup`
221+
222+
`SIGKILL`s processes that were spawned with render and have not halted by the end of the test.
223+
224+
> Please note that this is done automatically if the testing framework you're using supports the `afterEach` global and it is injected to your testing environment (like mocha, Jest, and Jasmine). If not, you will need to do manual cleanups after each test.
225+
226+
For example, if you're using the [ava](https://github.com/avajs/ava) testing framework, then you would need to use the `test.afterEach` hook like so:
227+
228+
```javascript
229+
import {cleanup, render} from 'cli-testing-library'
230+
import test from 'ava'
231+
232+
test.afterEach(cleanup)
233+
234+
test('renders into document', () => {
235+
render('long-running-command')
236+
// ...
237+
})
238+
239+
// ... more tests ...
240+
```
241+
242+
Failing to call cleanup when you've called render could result in Jest failing to close due to unclosed handles and tests which are not "idempotent" (which can lead to difficult to debug errors in your tests).

docs/configure.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Configuration Options
22

3+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
4+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
5+
6+
- [Introduction](#introduction)
7+
- [Options](#options)
8+
- [`showOriginalStackTrace`](#showoriginalstacktrace)
9+
- [`throwSuggestions` (experimental)](#throwsuggestions-experimental)
10+
- [`getInstanceError`](#getinstanceerror)
11+
- [`asyncUtilTimeout`](#asyncutiltimeout)
12+
- [`renderAwaitTime`](#renderawaittime)
13+
14+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
15+
316
## Introduction
417

518
The library can be configured via the `configure` function, which accepts:

docs/debug.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Debug
22

3+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
4+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
5+
6+
- [Automatic Logging](#automatic-logging)
7+
- [`prettyCLI`](#prettycli)
8+
9+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
10+
311
## Automatic Logging
412

513
When you use any `get` calls in your test cases, the current state of the

docs/differences.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ distinctions between the project's APIs.
1313
- [Instances](#instances)
1414
- [Queries](#queries)
1515
- [Events](#events)
16-
- [FireEvent](#fireevent)
17-
- [UserEvent](#userevent)
16+
- [FireEvent](#fireevent)
17+
- [UserEvent](#userevent)
1818
- [Matchers](#matchers)
1919
- [Similarities](#similarities)
2020

docs/fire-event.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
22
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
33

4-
**Table of Contents** _generated with
5-
[DocToc](https://github.com/thlorenz/doctoc)_
6-
74
- [Firing Events](#firing-events)
85
- [`fireEvent`](#fireevent)
96
- [`fireEvent[eventName]`](#fireeventeventname)

docs/introduction.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ npm install --save-dev cli-testing-library
1010

1111
- [`cli-testing-library` on GitHub](https://github.com/crutchcorn/cli-testing-library)
1212

13+
## Table of Contents
14+
1315
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
1416
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
1517

@@ -46,3 +48,14 @@ will work when a real user uses it.
4648

4749
1. A test runner or framework
4850
2. Specific to a testing framework (though we recommend Jest as our preference, the library works with any framework.)
51+
52+
# Further Reading
53+
54+
- [API reference for `render` and friends](./api.md)
55+
- [Jest matchers](./matchers.md)
56+
- [Mock user input](./user-event.md)
57+
- [Manually fire input events](./fire-event.md)
58+
- [Output matching queries](./queries.md)
59+
- [Debugging "CLI Testing Library" tests](./debug.md)
60+
- [Configure library options](./configure.md)
61+
- [Differences between us and other "Testing Library" projects](./differences.md)

docs/user-event.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ interactions than the [`fireEvent`](./fire-event) method.
44
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
55
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
66

7-
**Table of Contents** _generated with
8-
[DocToc](https://github.com/thlorenz/doctoc)_
9-
107
- [Import](#import)
118
- [API](#api)
129
- [`keyboard(instance, text, [options])`](#keyboardinstance-text-options)

0 commit comments

Comments
 (0)