Skip to content

Commit 5bd6ee1

Browse files
rickhanloniimjesun
authored andcommitted
Backfill 22.x docs (jestjs#5822)
1 parent 5ec4092 commit 5bd6ee1

File tree

90 files changed

+19198
-147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+19198
-147
lines changed

crowdin.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ files:
4343
'vi': 'vi'
4444
'zh-CN': 'zh-Hans'
4545
'zh-TW': 'zh-Hant'
46+
-
47+
source: '/website/versioned_docs/**/*.md'
48+
translation: '/website/translated_docs/%locale%/**/%original_file_name%'
49+
languages_mapping: *anchor
4650
-
4751
source: '/website/i18n/en.json'
4852
translation: '/website/i18n/%locale%.json'

docs/CLI.md

-4
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ commit. Behaves similarly to `--onlyChanged`.
129129

130130
### `--changedSince`
131131

132-
##### available in Jest **22.2.0+**
133-
134132
Runs tests related the changes since the provided branch. If the current branch
135133
has diverged from the given branch, then only changes made locally will be
136134
tested. Behaves similarly to `--onlyChanged`.
@@ -144,8 +142,6 @@ fail the test and require Jest to be run with `--updateSnapshot`.
144142

145143
### `--clearCache`
146144

147-
##### available in Jest **22.0.0+**
148-
149145
Deletes the Jest cache directory and then exits without running tests. Will
150146
delete `cacheDirectory` if the option is passed, or Jest's default cache
151147
directory. The default cache directory can be found by calling

docs/Configuration.md

-16
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,6 @@ tests._
506506

507507
Default: `undefined`
508508

509-
##### available in Jest **20.0.0+**
510-
511509
Use this configuration option to add custom reporters to Jest. A custom reporter
512510
is a class that implements `onRunStart`, `onTestStart`, `onTestResult`,
513511
`onRunComplete` methods that will be called when any of those events occurs.
@@ -606,8 +604,6 @@ programmatically using [`jest.resetModules()`](#jest-resetmodules).
606604

607605
Default: `undefined`
608606

609-
##### available in Jest **20.0.0+**
610-
611607
This option allows the use of a custom resolver. This resolver must be a node
612608
module that exports a function expecting a string as the first argument for the
613609
path to resolve and an object with the following structure as the second
@@ -677,8 +673,6 @@ where you may want to have multiple roots within one project, for example
677673

678674
### `runner` [string]
679675

680-
##### available in Jest **21.0.0+**
681-
682676
Default: `"jest-runner"`
683677

684678
This option allows you to use a custom runner instead of Jest's default test
@@ -816,8 +810,6 @@ you can use the `node` option to use a node-like environment instead.
816810
If some tests require another environment, you can add a `@jest-environment`
817811
docblock.
818812

819-
##### available in Jest **20.0.0+**
820-
821813
```js
822814
/**
823815
* @jest-environment jsdom
@@ -835,8 +827,6 @@ environment. The module must export a class with `setup`, `teardown` and
835827
suites by assigning them to `this.global` object – this will make them
836828
available in your test suites as global variables.
837829

838-
##### available in Jest **22.0.0+**
839-
840830
_Note: TestEnvironment is sandboxed. Each test suite will trigger setup/teardown
841831
in their own TestEnvironment._
842832

@@ -880,8 +870,6 @@ beforeAll(() => {
880870

881871
### `testEnvironmentOptions` [Object]
882872

883-
##### available in Jest **22.0.0+**
884-
885873
Default: `{}`
886874

887875
Test environment options that will be passed to the `testEnvironment`. The
@@ -891,8 +879,6 @@ given to [jsdom](https://github.com/tmpvar/jsdom) such as
891879

892880
### `testMatch` [array<string>]
893881

894-
##### available in Jest **19.0.0+**
895-
896882
(default: `[ '**/__tests__/**/*.js?(x)', '**/?(*.)+(spec|test).js?(x)' ]`)
897883

898884
The glob patterns Jest uses to detect test files. By default it looks for `.js`
@@ -1110,8 +1096,6 @@ errors will also still be shown on the bottom after execution.
11101096

11111097
Default: `[]`
11121098

1113-
##### available in Jest **21.0.0+**
1114-
11151099
An array of RegExp patterns that are matched against all source file paths
11161100
before re-running tests in watch mode. If the file path matches any of the
11171101
patterns, when it is updated, it will not trigger a re-run of tests.

docs/ExpectAPI.md

-4
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,6 @@ test('the best flavor is not coconut', () => {
455455

456456
### `.resolves`
457457

458-
##### available in Jest **20.0.0+**
459-
460458
Use `resolves` to unwrap the value of a fulfilled promise so any other matcher
461459
can be chained. If the promise is rejected the assertion fails.
462460

@@ -485,8 +483,6 @@ test('resolves to lemon', async () => {
485483

486484
### `.rejects`
487485

488-
##### available in Jest **20.0.0+**
489-
490486
Use `.rejects` to unwrap the reason of a rejected promise so any other matcher
491487
can be chained. If the promise is fulfilled the assertion fails.
492488

docs/JestObjectAPI.md

-6
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,6 @@ Returns the `jest` object for chaining.
314314

315315
### `jest.restoreAllMocks()`
316316

317-
##### available in Jest **21.1.0+**
318-
319317
Restores all mocks back to their original value. Equivalent to calling
320318
`.mockRestore` on every mocked function. Beware that `jest.restoreAllMocks()`
321319
only works when mock was created with `jest.spyOn`; other mocks will require you
@@ -464,8 +462,6 @@ Returns the `jest` object for chaining.
464462

465463
### `jest.spyOn(object, methodName)`
466464

467-
##### available in Jest **19.0.0+**
468-
469465
Creates a mock function similar to `jest.fn` but also tracks calls to
470466
`object[methodName]`. Returns a Jest mock function.
471467

@@ -506,8 +502,6 @@ test('plays video', () => {
506502

507503
### `jest.spyOn(object, methodName, accessType?)`
508504

509-
##### available in Jest **22.1.0+**
510-
511505
Since Jest 22.1.0+, the `jest.spyOn` method takes an optional third argument of
512506
`accessType` that can be either `'get'` or `'set'`, which proves to be useful
513507
when you want to spy on a getter or a setter, respectively.

docs/MockFunctionAPI.md

-12
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ implementation is given, the mock function will return `undefined` when invoked.
1818

1919
### `mockFn.getMockName()`
2020

21-
##### available in Jest **22.0.0+**
22-
2321
Returns the mock name string set by calling `mockFn.mockName(value)`.
2422

2523
### `mockFn.mock.calls`
@@ -211,8 +209,6 @@ console.log(myMockFn(), myMockFn(), myMockFn(), myMockFn());
211209

212210
### `mockFn.mockName(value)`
213211

214-
##### available in Jest **22.0.0+**
215-
216212
Accepts a string to use in test result output in place of "jest.fn()" to
217213
indicate which mock function is being referenced.
218214

@@ -274,8 +270,6 @@ console.log(myMockFn(), myMockFn(), myMockFn(), myMockFn());
274270

275271
### `mockFn.mockResolvedValue(value)`
276272

277-
##### available in Jest **22.2.0+**
278-
279273
Simple sugar function for:
280274

281275
```js
@@ -294,8 +288,6 @@ test('async test', async () => {
294288

295289
### `mockFn.mockResolvedValueOnce(value)`
296290

297-
##### available in Jest **22.2.0+**
298-
299291
Simple sugar function for:
300292

301293
```js
@@ -321,8 +313,6 @@ test('async test', async () => {
321313

322314
### `mockFn.mockRejectedValue(value)`
323315

324-
##### available in Jest **22.2.0+**
325-
326316
Simple sugar function for:
327317

328318
```js
@@ -341,8 +331,6 @@ test('async test', async () => {
341331

342332
### `mockFn.mockRejectedValueOnce(value)`
343333

344-
##### available in Jest **22.2.0+**
345-
346334
Simple sugar function for:
347335

348336
```js

docs/MockFunctions.md

-2
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ const otherObj = {
266266

267267
## Mock Names
268268

269-
##### available in Jest **22.0.0+**
270-
271269
You can optionally provide a name for your mock functions, which will be
272270
displayed instead of "jest.fn()" in test error output. Use this if you want to
273271
be able to quickly identify the mock function reporting an error in your test

docs/TestingAsyncCode.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ test('the fetch fails with an error', () => {
8686

8787
### `.resolves` / `.rejects`
8888

89-
##### available in Jest **20.0.0+**
90-
9189
You can also use the `.resolves` matcher in your expect statement, and Jest will
9290
wait for that promise to resolve. If the promise is rejected, the test will
9391
automatically fail.
@@ -136,8 +134,7 @@ test('the fetch fails with an error', async () => {
136134
});
137135
```
138136

139-
Of course, you can combine `async` and `await` with `.resolves` or `.rejects`
140-
(available in Jest **20.0.0+**).
137+
Of course, you can combine `async` and `await` with `.resolves` or `.rejects`.
141138

142139
```js
143140
test('the data is peanut butter', async () => {

docs/TutorialAsync.md

-4
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ return a Promise at the end.
9090

9191
### `.resolves`
9292

93-
##### available in Jest **20.0.0+**
94-
9593
There is a less verbose way using `resolves` to unwrap the value of a fulfilled
9694
promise together with any other matcher. If the promise is rejected, the
9795
assertion will fail.
@@ -159,8 +157,6 @@ it('tests error with async/await', async () => {
159157

160158
### `.rejects`
161159

162-
##### available in Jest **20.0.0+**
163-
164160
The`.rejects` helper works like the `.resolves` helper. If the promise is
165161
fulfilled, the test will automatically fail.
166162

website/pages/en/versions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class Versions extends React.Component {
7979
version =>
8080
version !== latestVersion && (
8181
<tr key={version}>
82-
<th>{version}</th>
82+
<th>{version === '22.0' ? '<=22' : version}</th>
8383
<td>
8484
<a
8585
href={`${

0 commit comments

Comments
 (0)