Skip to content

Commit 6c9b55c

Browse files
tanebakoba04
andcommitted
Translate testing (#241)
* Translate testing * use plainer word for considering * Update content/docs/testing.md Co-Authored-By: Toru Kobayashi <[email protected]> * Update content/docs/testing.md Co-Authored-By: Toru Kobayashi <[email protected]> * Update content/docs/testing.md Co-Authored-By: Toru Kobayashi <[email protected]> * Update content/docs/testing.md Co-Authored-By: Toru Kobayashi <[email protected]> * Update content/docs/testing.md Co-Authored-By: Toru Kobayashi <[email protected]> * Update content/docs/testing.md Co-Authored-By: Toru Kobayashi <[email protected]> * Update content/docs/testing.md Co-Authored-By: Toru Kobayashi <[email protected]> * Update content/docs/testing.md Co-Authored-By: Toru Kobayashi <[email protected]> * Update content/docs/testing.md Co-Authored-By: Toru Kobayashi <[email protected]> * Update content/docs/testing.md Co-Authored-By: Toru Kobayashi <[email protected]> * Update content/docs/testing.md Co-Authored-By: Toru Kobayashi <[email protected]>
1 parent 4b6ef8a commit 6c9b55c

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

content/docs/testing.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
---
22
id: testing
3-
title: Testing Overview
3+
title: テスト概要
44
permalink: docs/testing.html
55
redirect_from:
66
- "community/testing.html"
77
next: testing-recipes.html
88
---
99

10-
You can test React components similar to testing other JavaScript code.
10+
React コンポーネントは他の JavaScript のコードと同じようにテストできます。
1111

12-
There are a few ways to test React components. Broadly, they divide into two categories:
12+
React コンポーネントをテストするのにはいくつか方法がありますが、大きく 2 つのカテゴリに分けられます。
1313

14-
* **Rendering component trees** in a simplified test environment and asserting on their output.
15-
* **Running a complete app** in a realistic browser environment (also known as “end-to-end” tests).
14+
* **コンポーネントツリーのレンダリング** をシンプルなテスト環境で行い、その結果を検証する
15+
* **アプリケーション全体の動作** をブラウザ同等の環境で検証する(end-to-end テストとして知られる)
1616

17-
This documentation section focuses on testing strategies for the first case. While full end-to-end tests can be very useful to prevent regressions to important workflows, such tests are not concerned with React components in particular, and are out of scope of this section.
17+
このセクションでは、最初のケースにおけるテスト戦略にフォーカスします。end-to-end テストが重要な機能のリグレッションを防ぐのに有効である一方で、そのようなテストは React コンポーネントとは特に関係なく、このセクションのスコープ外です。
1818

19-
### Tradeoffs {#tradeoffs}
19+
### トレードオフ {#tradeoffs}
2020

2121

22-
When choosing testing tools, it is worth considering a few tradeoffs:
22+
テストツールを選定する時、いくつかのトレードオフを考慮することは価値があります。
2323

24-
* **Iteration speed vs Realistic environment:** Some tools offer a very quick feedback loop between making a change and seeing the result, but don't model the browser behavior precisely. Other tools might use a real browser environment, but reduce the iteration speed and are flakier on a continuous integration server.
25-
* **How much to mock:** With components, the distinction between a "unit" and "integration" test can be blurry. If you're testing a form, should its test also test the buttons inside of it? Or should a button component have its own test suite? Should refactoring a button ever break the form test?
24+
* **実行速度 vs 環境の現実度:** 変更を加えてから結果を見るまでのフィードバックが早いツールは、ブラウザでの動作を正確に模倣しません。一方実際のブラウザ環境を使うようなツールは、イテレーションの速度が落ちる上 CI サーバーでは壊れやすいです。
25+
* **モックの粒度** コンポーネントのテストでは、ユニットテストとインテグレーションテストの区別は曖昧です。フォームをテストする時、そのテストはフォーム内のボタンもテストすべきでしょうか。それともボタンコンポーネント自体が自身のテストを持つべきでしょうか。ボタンのリファクタリングはフォームのテストを壊さないべきでしょうか。
2626

27-
Different answers may work for different teams and products.
27+
チームやプロダクトに応じて、答えは違ってきます。
2828

29-
### Recommended Tools {#tools}
29+
### 推奨ツール {#tools}
3030

31-
**[Jest](https://facebook.github.io/jest/)** is a JavaScript test runner that lets you access the DOM via [`jsdom`](#mocking-a-rendering-surface). While jsdom is only an approximation of how the browser works, it is often good enough for testing React components. Jest provides a great iteration speed combined with powerful features like mocking [modules](#mocking-modules) and [timers](#mocking-timers) so you can have more control over how the code executes.
31+
**[Jest](https://facebook.github.io/jest/)** [`jsdom`](#mocking-a-rendering-surface) を通じて DOM にアクセスできる JavaScript のテストランナーです。jsdom はブラウザの模倣環境にすぎませんが、React コンポーネントをテストするのには十分なことが多いです。Jest [モジュール](#mocking-modules) [タイマー](#mocking-timers) のモックのような機能を組み合わせて、高速にイテレーションを回すことができ、コードをどう実行するかをよりコントロールできます。
3232

33-
**[React Testing Library](https://testing-library.com/react)** is a set of helpers that let you test React components without relying on their implementation details. This approach makes refactoring a breeze and also nudges you towards best practices for accessibility. Although it doesn't provide a way to "shallowly" render a component without its children, a test runner like Jest lets you do this by [mocking](/docs/testing-recipes.html#mocking-modules).
33+
**[React Testing Library](https://testing-library.com/react)** は実装の詳細に依存せずに React コンポーネントをテストすることができるツールセットです。このアプローチはリファクタリングを容易にし、さらにアクセスビリティのベスト・プラクティスへと手向けてくれます。コンポーネントを children 抜きに「浅く」レンダリングする方法は提供していませんが、Jest のようなテストランナーで [モック](/docs/testing-recipes.html#mocking-modules) することで可能です。
3434

35-
### Learn More {#learn-more}
35+
### より詳しく {#learn-more}
3636

37-
This section is divided in two pages:
37+
このセクションは 2 つのページに分かれます:
3838

39-
- [Recipes](/docs/testing-recipes.html): Common patterns when writing tests for React components.
40-
- [Environments](/docs/testing-environments.html): What to consider when setting up a testing environment for React components.
39+
- [レシピ集](/docs/testing-recipes.html)React コンポーネントのテストを書く際の一般的なパターン集
40+
- [Environments](/docs/testing-environments.html)React コンポーネントのためのテスト環境をセットアップする際に考えること

0 commit comments

Comments
 (0)