Skip to content

docs(cn): translate jest/docs/SnapshotTesting.md#16

Open
zzllover wants to merge 1 commit intodocschina:cnfrom
zzllover:cn-snapshot-testing
Open

docs(cn): translate jest/docs/SnapshotTesting.md#16
zzllover wants to merge 1 commit intodocschina:cnfrom
zzllover:cn-snapshot-testing

Conversation

@zzllover
Copy link
Collaborator

Summary

Test plan

@@ -3,13 +3,13 @@ id: snapshot-testing
title: Snapshot Testing
Copy link
Contributor

Choose a reason for hiding this comment

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

title也需要翻译

![](/img/content/failedSnapshotTest.png)

Since we just updated our component to point to a different address, it's reasonable to expect changes in the snapshot for this component. Our snapshot test case is failing because the snapshot for our updated component no longer matches the snapshot artifact for this test case.
由于我们刚刚将组件更新为指向一个不同的链接地址,因此能够合理的预期此组件快照的更改。我们的快照测试示例测试未通过,原因在于已更改组件的快照不再与测试用例中的快照工件相匹配。
Copy link
Contributor

Choose a reason for hiding this comment

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

工件 -> 制品

由于我们刚刚将组件更新为指向一个不同的链接地址,因此能够合理的预期此组件快照的更改。我们的快照测试示例测试未通过,原因在于已更改组件的快照不再与测试用例中的快照工件相匹配。

To resolve this, we will need to update our snapshot artifacts. You can run Jest with a flag that will tell it to re-generate snapshots:
为解决此问题,我们将需要更新测试用例中的快照工件。你可以运行Jest,并附带一个标志参数,它表示重新生成快照。
Copy link
Contributor

Choose a reason for hiding this comment

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

工件 -> 制品

你可以通过克隆[快照用例](https://github.com/facebook/jest/tree/master/examples/snapshot), 修改`Link`组件并运行Jest来测试这一功能。

### Interactive Snapshot Mode
### 交互性快照模式
Copy link
Contributor

Choose a reason for hiding this comment

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

可交互

![](/img/content/interactiveSnapshot.png)

Once you enter Interactive Snapshot Mode, Jest will step you through the failed snapshots one test at a time and give you the opportunity to review the failed output.
进入交互性快照模式后,Jest将在一次测试中逐步引导你通过失败的快照,并给予你观察错误的日志输出。
Copy link
Contributor

Choose a reason for hiding this comment

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

并给予你观察错误的日志输出的机会

@@ -268,6 +269,7 @@ exports[`<UserName /> should render Alan Turing`] = `
```

Since the later describes exactly what's expected in the output, it's more clear to see when it's wrong:
Copy link
Contributor

Choose a reason for hiding this comment

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

请删除已经翻译的英文内容

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants