Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Conversation

@bebetaro
Copy link
Contributor

概要

I translated docs/testing-css-in-js page 😄
Original: https://www.gatsbyjs.org/docs/testing-css-in-js/
I appreciate to your review to my pull request 🙇
If I need to fix some points, please tell me about it. I will do it asap! Thanks!

チェックリスト

  • 翻訳スタイルガイド に目を通しました。
  • Translation Guide に目を通しました。
  • textlint を使って校正を行いました(推奨)
  • Allow edits from maintainers にチェックを入れました。

しばらく待ってもレビューが終わらなかったり、必要なレビュー数が足りない状態が続いた場合は、こちらからメンテナーを探して、@を付けてメンションを飛ばしてください。

@smorimoto smorimoto added the status: awaiting review A pull request that is currently awaiting a reviewer's response label Jan 18, 2020
Copy link
Contributor

@uetchy uetchy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -1,24 +1,24 @@
---
title: Testing CSS-in-JS
title: CSS-in-JSのテスト
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: CSS-in-JSのテスト
title: CSS-in-JS のテスト

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

スペース抜けてましたね。修正しました!

---

Popular CSS-in-JS libraries like [styled-components](https://github.com/styled-components/styled-components) or [emotion](https://github.com/emotion-js/emotion) can also be tested with the help of [jest-styled-components](https://github.com/styled-components/jest-styled-components) or [jest-emotion](https://github.com/emotion-js/emotion/tree/master/packages/jest-emotion) respectively. These packages improve Jest's built-in snapshot testing experience and are a great way to help avoid unintended changes to your website's UI. Please refer to your package's documentation to see if it also offers testing capabilities.
[styled-components](https://github.com/styled-components/styled-components) [emotion](https://github.com/emotion-js/emotion) のような人気のある CSS-in-JS ライブラリーは、それぞれ [jest-styled-components](https://github.com/styled-components/jest-styled-components) [jest-emotion](https://github.com/emotion-js/emotion/tree/master/packages/jest-emotion) の助けを受けてテストすることもできます。これらのパッケージは、Jest のもともと持っているスナップショットテスト機能を改善してくれます。そして、これは、あなたのウェブサイト上で起こる意図しない UI の変化を避けやすくしてくれる素晴らしい方法となります。どうぞあなたが使用しているパッケージのドキュメントを参照して、そのパッケージがテスト機能もまた提供しているか見てみてください。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[styled-components](https://github.com/styled-components/styled-components)[emotion](https://github.com/emotion-js/emotion) のような人気のある CSS-in-JS ライブラリーは、それぞれ [jest-styled-components](https://github.com/styled-components/jest-styled-components)[jest-emotion](https://github.com/emotion-js/emotion/tree/master/packages/jest-emotion) の助けを受けてテストすることもできます。これらのパッケージは、Jest のもともと持っているスナップショットテスト機能を改善してくれます。そして、これは、あなたのウェブサイト上で起こる意図しない UI の変化を避けやすくしてくれる素晴らしい方法となります。どうぞあなたが使用しているパッケージのドキュメントを参照して、そのパッケージがテスト機能もまた提供しているか見てみてください
[styled-components](https://github.com/styled-components/styled-components)[emotion](https://github.com/emotion-js/emotion) のような人気のある CSS-in-JS ライブラリーは、それぞれ [jest-styled-components](https://github.com/styled-components/jest-styled-components)[jest-emotion](https://github.com/emotion-js/emotion/tree/master/packages/jest-emotion) の助けを受けてテストすることもできます。これらのパッケージは、Jest のもともと持っているスナップショットテスト機能を改善してくれます。そして、これはあなたのウェブサイト上で起こる意図しない UI の変化を避けやすくしてくれる素晴らしい方法となります。どうぞあなたが使用しているパッケージのドキュメントを参照して、そのパッケージがテスト機能を提供しているか確かめてください

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

提示されました訳に修正しました!

[styled-components](https://github.com/styled-components/styled-components) [emotion](https://github.com/emotion-js/emotion) のような人気のある CSS-in-JS ライブラリーは、それぞれ [jest-styled-components](https://github.com/styled-components/jest-styled-components) [jest-emotion](https://github.com/emotion-js/emotion/tree/master/packages/jest-emotion) の助けを受けてテストすることもできます。これらのパッケージは、Jest のもともと持っているスナップショットテスト機能を改善してくれます。そして、これは、あなたのウェブサイト上で起こる意図しない UI の変化を避けやすくしてくれる素晴らしい方法となります。どうぞあなたが使用しているパッケージのドキュメントを参照して、そのパッケージがテスト機能もまた提供しているか見てみてください。

_Snapshot serializers_ like `jest-styled-components` or `jest-emotion` modify the standard output to a more meaningful and readable snapshot, e.g. by removing unnecessary information or displaying data in another format. Which ultimately leads to more comparable and effective snapshot tests.
`jest-styled-components` `jest-emotion` のような*スナップショットシリアライザー*は、標準の出力をより意味があり読みやすいスナップショットに修正してくれます。例えば、不必要な情報を取り除いたり、異なるフォーマットでデータを表示してくれます。結果として、スナップショットシリアライザーは、より違いがわかりやすい効率的なスナップショットテストを導いてくれます。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`jest-styled-components``jest-emotion` のような*スナップショットシリアライザー*は、標準の出力をより意味があり読みやすいスナップショットに修正してくれます。例えば、不必要な情報を取り除いたり、異なるフォーマットでデータを表示してくれます。結果として、スナップショットシリアライザーは、より違いがわかりやすい効率的なスナップショットテストを導いてくれます。
`jest-styled-components``jest-emotion` のような**スナップショットシリアライザー**は、標準の出力をより意味があり読みやすいスナップショットに修正してくれます。例えば、不必要な情報を取り除いたり、異なるフォーマットでデータを表示してくれます。結果として、スナップショットシリアライザーは、より違いがわかりやすい効率的なスナップショットテストを導いてくれます。

日本語だと斜体は目立たないので太字に変更します。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

太字にしました!

[Gatsby's emotion plugin](/packages/gatsby-plugin-emotion/) は、内部的に `babel-plugin-emotion` を使用していますので、Jest が使えるようにこれも一緒にインストールしましよう。

If you followed along with the [Unit testing guide](/docs/unit-testing) you'll have the file `jest-preprocess.js` at the root of your project. Open that file and add the plugin:
もしあなたが [Unit testing guide](/docs/unit-testing) に取り組んだのならば、あなたのプロジェクトの root には `jest-preprocess.js` があるでしょう。そのファイルを開いて、プラグインを追加してください。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
もしあなたが [Unit testing guide](/docs/unit-testing) に取り組んだのならば、あなたのプロジェクトの root には `jest-preprocess.js` があるでしょう。そのファイルを開いて、プラグインを追加してください。
もしあなたが[ユニットテストガイド](/docs/unit-testing)に取り組んだのならば、あなたのプロジェクトの root には `jest-preprocess.js` があるでしょう。そのファイルを開いて、プラグインを追加してください。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

カタカナに直しました!

```

In order to tell Jest to use the serializer you'll need to create the file `setup-test-env.js` which will be run automatically before every test. Create the file `setup-test-env.js` at the root of your project. Insert this code into it:
Jest にシリアライザーを使用するよう教えるために、あなたは `setup-test-env.js` というファイルを作る必要があります。これはテスト前に毎回自動的に実行されます。プロジェクトの root に `setup-test-env.js` を作り、以下のコードを追加してください。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Jest にシリアライザーを使用するよう教えるために、あなたは `setup-test-env.js` というファイルを作る必要があります。これはテスト前に毎回自動的に実行されます。プロジェクトの root に `setup-test-env.js` を作り、以下のコードを追加してください。
Jest にシリアライザーを使用するよう教えるために、あなたは `setup-test-env.js` というファイルを作る必要があります。これはテスト前に毎回自動的に実行されます。プロジェクトのルートに `setup-test-env.js` を作り、以下のコードを追加してください。

Copy link
Contributor Author

@bebetaro bebetaro Jan 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

カタカナに修正しました!
また、他の箇所のrootもカタカナとしました!

```

Lastly you need to tell Jest where to find this file. Open your `package.json` and add this entry to your `"jest"` section:
最後に、Jest にこのファイルがどこにあるかを教える必要があります。 `package.json` を開いて、以下のように `"jest"` の場所に追加してください。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
最後に、Jest にこのファイルがどこにあるかを教える必要があります。 `package.json` を開いて、以下のように `"jest"` の場所に追加してください
最後に、Jest にこのファイルがどこにあるかを教える必要があります。 `package.json` を開いて、`"jest"` の場所に以下のように追加してください

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

提示されました訳に修正しました!

@uetchy uetchy added status: awaiting author response A pull request that is awaiting author's response and removed status: awaiting review A pull request that is currently awaiting a reviewer's response labels Jan 26, 2020
Copy link
Contributor

@uetchy uetchy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@uetchy uetchy added status: awaiting more approval A pull request that is awaiting reviewer #2 to be assigned and removed status: awaiting author response A pull request that is awaiting author's response labels Jan 27, 2020
Copy link
Contributor

@hirotaka hirotaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます!
LGTM 👍

@hirotaka hirotaka merged commit cd2e602 into gatsbyjs:master Jan 28, 2020
@uetchy uetchy removed the status: awaiting more approval A pull request that is awaiting reviewer #2 to be assigned label Jan 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants