Skip to content

Commit eab9649

Browse files
dustinryersoneddyerburgh
authored andcommitted
docs: update Jest website links (#1134)
fixes #1133
1 parent 83f8754 commit eab9649

20 files changed

+52
-52
lines changed

Diff for: docs/guides/choosing-a-test-runner.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ There are many popular JavaScript test runners, and Vue Test Utils works with al
66

77
There are a few things to consider when choosing a test runner though: feature set, performance, and support for single-file component (SFC) pre-compilation. After carefully comparing existing libraries, here are two test runners that we recommend:
88

9-
- [Jest](https://facebook.github.io/jest/docs/en/getting-started.html#content) is the most fully featured test runner. It requires the least configuration, sets up JSDOM by default, provides built-in assertions, and has a great command line user experience. However, you will need a preprocessor to be able to import SFC components in your tests. We have created the `vue-jest` preprocessor which can handle most common SFC features, but it currently does not have 100% feature parity with `vue-loader`.
9+
- [Jest](https://jestjs.io/docs/en/getting-started.html#content) is the most fully featured test runner. It requires the least configuration, sets up JSDOM by default, provides built-in assertions, and has a great command line user experience. However, you will need a preprocessor to be able to import SFC components in your tests. We have created the `vue-jest` preprocessor which can handle most common SFC features, but it currently does not have 100% feature parity with `vue-loader`.
1010

1111
- [mocha-webpack](https://github.com/zinserjan/mocha-webpack) is a wrapper around webpack + Mocha, but with a more streamlined interface and watch mode. The benefits of this setup is that we can get complete SFC support via webpack + `vue-loader`, but it requires more configuration upfront.
1212

Diff for: docs/guides/testing-async-components.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
To simplify testing, Vue Test Utils applies DOM updates _synchronously_. However, there are some techniques you need to be aware of when testing a component with asynchronous behavior such as callbacks or promises.
44

5-
One of the most common asynchronous behaviors is API calls and Vuex actions. The following examples shows how to test a method that makes an API call. This example uses Jest to run the test and to mock the HTTP library `axios`. More about Jest manual mocks can be found [here](https://facebook.github.io/jest/docs/en/manual-mocks.html#content).
5+
One of the most common asynchronous behaviors is API calls and Vuex actions. The following examples shows how to test a method that makes an API call. This example uses Jest to run the test and to mock the HTTP library `axios`. More about Jest manual mocks can be found [here](https://jestjs.io/docs/en/manual-mocks.html#content).
66

77
The implementation of the `axios` mock looks like this:
88

Diff for: docs/guides/testing-single-file-components-with-jest.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> An example project for this setup is available on [GitHub](https://github.com/vuejs/vue-test-utils-jest-example).
44
5-
Jest is a test runner developed by Facebook, aiming to deliver a battery-included unit testing solution. You can learn more about Jest on its [official documentation](https://facebook.github.io/jest/).
5+
Jest is a test runner developed by Facebook, aiming to deliver a battery-included unit testing solution. You can learn more about Jest on its [official documentation](https://jestjs.io/).
66

77
#### Setting up Jest
88

@@ -122,15 +122,15 @@ Example `.babelrc`:
122122

123123
### Placing Test Files
124124

125-
By default, Jest will recursively pick up all files that have a `.spec.js` or `.test.js` extension in the entire project. If this does not fit your needs, it's possible [to change the `testRegex`](https://facebook.github.io/jest/docs/en/configuration.html#testregex-string) in the config section in the `package.json` file.
125+
By default, Jest will recursively pick up all files that have a `.spec.js` or `.test.js` extension in the entire project. If this does not fit your needs, it's possible [to change the `testRegex`](https://jestjs.io/docs/en/configuration.html#testregex-string-array-string) in the config section in the `package.json` file.
126126

127127
Jest recommends creating a `__tests__` directory right next to the code being tested, but feel free to structure your tests as you see fit. Just beware that Jest would create a `__snapshots__` directory next to test files that performs snapshot testing.
128128

129129
### Coverage
130130

131131
Jest can be used to generate coverage reports in multiple formats. The following is a simple example to get started with:
132132

133-
Extend your `jest` config (usually in `package.json` or `jest.config.js`) with the [`collectCoverage`](https://facebook.github.io/jest/docs/en/configuration.html#collectcoverage-boolean) option, and then add the [`collectCoverageFrom`](https://facebook.github.io/jest/docs/en/configuration.html#collectcoveragefrom-array) array to define the files for which coverage information should be collected.
133+
Extend your `jest` config (usually in `package.json` or `jest.config.js`) with the [`collectCoverage`](https://jestjs.io/docs/en/configuration.html#collectcoverage-boolean) option, and then add the [`collectCoverageFrom`](https://jestjs.io/docs/en/configuration.html#collectcoveragefrom-array) array to define the files for which coverage information should be collected.
134134

135135
```json
136136
{
@@ -142,7 +142,7 @@ Extend your `jest` config (usually in `package.json` or `jest.config.js`) with t
142142
}
143143
```
144144

145-
This will enable coverage reports with the [default coverage reporters](https://facebook.github.io/jest/docs/en/configuration.html#coveragereporters-array-string). You can customise these with the `coverageReporters` option:
145+
This will enable coverage reports with the [default coverage reporters](https://jestjs.io/docs/en/configuration.html#coveragereporters-array-string). You can customise these with the `coverageReporters` option:
146146

147147
```json
148148
{
@@ -153,11 +153,11 @@ This will enable coverage reports with the [default coverage reporters](https://
153153
}
154154
```
155155

156-
Further documentation can be found in the [Jest configuration documentation](https://facebook.github.io/jest/docs/en/configuration.html#collectcoverage-boolean), where you can find options for coverage thresholds, target output directories, etc.
156+
Further documentation can be found in the [Jest configuration documentation](https://jestjs.io/docs/en/configuration.html#collectcoverage-boolean), where you can find options for coverage thresholds, target output directories, etc.
157157

158158
### Example Spec
159159

160-
If you are familiar with Jasmine, you should feel right at home with Jest's [assertion API](https://facebook.github.io/jest/docs/en/expect.html#content):
160+
If you are familiar with Jasmine, you should feel right at home with Jest's [assertion API](https://jestjs.io/docs/en/expect.html#content):
161161

162162
```js
163163
import { mount } from '@vue/test-utils'
@@ -173,7 +173,7 @@ describe('Component', () => {
173173

174174
### Snapshot Testing
175175

176-
When you mount a component with Vue Test Utils, you get access to the root HTML element. This can be saved as a snapshot for [Jest snapshot testing](https://facebook.github.io/jest/docs/en/snapshot-testing.html):
176+
When you mount a component with Vue Test Utils, you get access to the root HTML element. This can be saved as a snapshot for [Jest snapshot testing](https://jestjs.io/docs/en/snapshot-testing.html):
177177

178178
```js
179179
test('renders correctly', () => {
@@ -205,5 +205,5 @@ Then configure it in `package.json`:
205205

206206
- [Example project for this setup](https://github.com/vuejs/vue-test-utils-jest-example)
207207
- [Examples and slides from Vue Conf 2017](https://github.com/codebryo/vue-testing-with-jest-conf17)
208-
- [Jest](https://facebook.github.io/jest/)
208+
- [Jest](https://jestjs.io/)
209209
- [Babel preset env](https://github.com/babel/babel-preset-env)

Diff for: docs/guides/using-with-typescript.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The next step is to add Jest to the project.
3030

3131
### Setting up Jest
3232

33-
Jest is a test runner developed by Facebook, aiming to deliver a battery-included unit testing solution. You can learn more about Jest on its [official documentation](https://facebook.github.io/jest/).
33+
Jest is a test runner developed by Facebook, aiming to deliver a battery-included unit testing solution. You can learn more about Jest on its [official documentation](https://jestjs.io/).
3434

3535
Install Jest and Vue Test Utils:
3636

@@ -154,4 +154,4 @@ That's all we need to do to get TypeScript and Vue Test Utils working together!
154154
### Resources
155155

156156
- [Example project for this setup](https://github.com/vuejs/vue-test-utils-typescript-example)
157-
- [Jest](https://facebook.github.io/jest/)
157+
- [Jest](https://jestjs.io/)

Diff for: docs/guides/using-with-vuex.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ What’s happening here? First we tell Vue to use Vuex with the `localVue.use` m
9494

9595
We then make a mock store by calling `new Vuex.Store` with our mock values. We only pass it the actions, since that’s all we care about.
9696

97-
The actions are [jest mock functions](https://facebook.github.io/jest/docs/en/mock-functions.html). These mock functions give us methods to assert whether the actions were called or not.
97+
The actions are [jest mock functions](https://jestjs.io/docs/en/mock-functions.html). These mock functions give us methods to assert whether the actions were called or not.
9898

9999
We can then assert in our tests that the action stub was called when expected.
100100

Diff for: docs/ja/guides/choosing-a-test-runner.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
ですが、テストランナを選択する際には、機能セット、パフォーマンス、および単一ファイルコンポーネント (SFC) の事前コンパイルのサポートなどを考慮すべきです。既存のライブラリを慎重に比較した上で、以下の 2 つのテストランナをお勧めします:
88

9-
- [Jest](https://facebook.github.io/jest/docs/en/getting-started.html#content) は最も充実したテストランナです。最小の設定が必要で、デフォルトで JSDOM を設定し、組み込みの検証を提供し、コマンドラインのユーザーエクスペリエンスが優れています。ただし、テストで SFC コンポーネントをインポートできるようにするには、プリプロセッサが必要です。最も一般的な SFC 機能を処理できる `vue-jest` プリプロセッサを作成しましたが、現在 `vue-loader` と 100% 同じ機能を持っていません。
9+
- [Jest](https://jestjs.io/docs/en/getting-started.html#content) は最も充実したテストランナです。最小の設定が必要で、デフォルトで JSDOM を設定し、組み込みの検証を提供し、コマンドラインのユーザーエクスペリエンスが優れています。ただし、テストで SFC コンポーネントをインポートできるようにするには、プリプロセッサが必要です。最も一般的な SFC 機能を処理できる `vue-jest` プリプロセッサを作成しましたが、現在 `vue-loader` と 100% 同じ機能を持っていません。
1010

1111
- [mocha-webpack](https://github.com/zinserjan/mocha-webpack) は webpack + Mocha のラッパですが、より合理的なインタフェースと watch モードを備えています。この設定のメリットは、webpack + `vue-loader` を使用して完全な SFC サポートを得ることができるということですが、より多くの設定を行う必要があります。
1212

Diff for: docs/ja/guides/testing-async-components.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
テストをシンプルにするために、 `vue-test-utils` は DOM の更新を同期的に適用します。しかし、コールバックや Promise のようなコンポーネントの非同期動作をテストする場合、いくつかのテクニックを知っておく必要があります。
44

5-
よくある非同期動作の 1 つとして API 呼び出しと Vuex の action があります。以下の例は API 呼び出しをするメソッドをテストする方法を示しています。この例は HTTP のライブラリである `axios` をモックしてテストを実行するために Jest を使っています。Jest のモックの詳細は[ここ](https://facebook.github.io/jest/docs/en/manual-mocks.html#content)にあります。
5+
よくある非同期動作の 1 つとして API 呼び出しと Vuex の action があります。以下の例は API 呼び出しをするメソッドをテストする方法を示しています。この例は HTTP のライブラリである `axios` をモックしてテストを実行するために Jest を使っています。Jest のモックの詳細は[ここ](https://jestjs.io/docs/en/manual-mocks.html#content)にあります。
66

77
`axios` のモックの実装はこのようにします。
88

Diff for: docs/ja/guides/testing-single-file-components-with-jest.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> このセットアップのサンプルプロジェクトは、 [GitHub](https://github.com/vuejs/vue-test-utils-jest-example) にあります。
44
5-
Jest は Facebook が開発したテストランナであり、ユニットテストソリューションの提供を目指しています。 Jest の詳細については、[公式ドキュメント](https://facebook.github.io/jest/)を参照してください。
5+
Jest は Facebook が開発したテストランナであり、ユニットテストソリューションの提供を目指しています。 Jest の詳細については、[公式ドキュメント](https://jestjs.io/)を参照してください。
66

77
### Jest のセットアップ
88

@@ -120,15 +120,15 @@ webpack で `babel-preset-env` を使用するとした場合、webpack は ES M
120120

121121
### テストファイルの配置
122122

123-
デフォルトでは、Jest はプロジェクト全体で `.spec.js` または `.test.js` 拡張子を持つすべてのファイルを再帰的に取得します。これがあなたのニーズに合わない場合は、`package.json` ファイルの config セクションで[testRegex を変更する](https://facebook.github.io/jest/docs/en/configuration.html#testregex-string)ことが可能です。
123+
デフォルトでは、Jest はプロジェクト全体で `.spec.js` または `.test.js` 拡張子を持つすべてのファイルを再帰的に取得します。これがあなたのニーズに合わない場合は、`package.json` ファイルの config セクションで[testRegex を変更する](https://jestjs.io/docs/en/configuration.html#testregex-string-array-string)ことが可能です。
124124

125125
Jest は、テスト対象のコードのすぐ隣に`__tests__`ディレクトリを作成することを推奨していますが、適切にテストを構造化することは自由です。 Jest がスナップショットテストを実行するテストファイルの隣に`__snapshots__`ディレクトリを作成することに注意してください。
126126

127127
### カバレッジ
128128

129129
Jest は複数のフォーマットでカバレッジを取ることができます。 以下はそれをするための簡単な例です。
130130

131-
`jest` の設定 (普通は `package.json` か  `jest.config.js`) に  [collectCoverage](https://facebook.github.io/jest/docs/en/configuration.html#collectcoverage-boolean) オプションを加えます。それから、カバレッジを収集する対象のファイルを [collectCoverageFrom](https://facebook.github.io/jest/docs/en/configuration.html#collectcoveragefrom-array) に配列で定義します。
131+
`jest` の設定 (普通は `package.json` か  `jest.config.js`) に  [collectCoverage](https://jestjs.io/docs/en/configuration.html#collectcoverage-boolean) オプションを加えます。それから、カバレッジを収集する対象のファイルを [collectCoverageFrom](https://jestjs.io/docs/en/configuration.html#collectcoveragefrom-array) に配列で定義します。
132132

133133
```json
134134
{
@@ -140,7 +140,7 @@ Jest は複数のフォーマットでカバレッジを取ることができま
140140
}
141141
```
142142

143-
[デフォルトのカバレッジレポーター](https://facebook.github.io/jest/docs/en/configuration.html#coveragereporters-array-string)のカバレッジレポートは有効になります。 `coverageReporters` オプションでそれらをカスタマイズすることができます。
143+
[デフォルトのカバレッジレポーター](https://jestjs.io/docs/en/configuration.html#coveragereporters-array-string)のカバレッジレポートは有効になります。 `coverageReporters` オプションでそれらをカスタマイズすることができます。
144144

145145
```json
146146
{
@@ -151,11 +151,11 @@ Jest は複数のフォーマットでカバレッジを取ることができま
151151
}
152152
```
153153

154-
より詳しい情報は [Jest configuration documentation](https://facebook.github.io/jest/docs/en/configuration.html#collectcoverage-boolean) にあります。 カバレッジの閾値やターゲットを出力するディレクトリなどのオプションが記載されています。
154+
より詳しい情報は [Jest configuration documentation](https://jestjs.io/docs/en/configuration.html#collectcoverage-boolean) にあります。 カバレッジの閾値やターゲットを出力するディレクトリなどのオプションが記載されています。
155155

156156
### Spec の例
157157

158-
あなたが Jasmine をよく知っているなら、Jest の [assertion API](https://facebook.github.io/jest/docs/en/expect.html#content)は自宅のように感じるはずです。
158+
あなたが Jasmine をよく知っているなら、Jest の [assertion API](https://jestjs.io/docs/en/expect.html#content)は自宅のように感じるはずです。
159159

160160
```js
161161
import { mount } from '@vue/test-utils'
@@ -171,7 +171,7 @@ describe('Component', () => {
171171

172172
### スナップショットテスト
173173

174-
Vue Test Utils でコンポーネントをマウントすると、コンポーネントのルート HTML 要素にアクセスすることができます。 [Jest のスナップショットテスト](https://facebook.github.io/jest/docs/en/snapshot-testing.html)で使用するためにこれを保存することができます。
174+
Vue Test Utils でコンポーネントをマウントすると、コンポーネントのルート HTML 要素にアクセスすることができます。 [Jest のスナップショットテスト](https://jestjs.io/docs/en/snapshot-testing.html)で使用するためにこれを保存することができます。
175175

176176
```js
177177
test('renders correctly', () => {
@@ -203,5 +203,5 @@ npm install --save-dev jest-serializer-vue
203203

204204
- [このセットアップのプロジェクト例](https://github.com/vuejs/vue-test-utils-jest-example)
205205
- [Vue Conf 2017 のスライド](https://github.com/codebryo/vue-testing-with-jest-conf17)
206-
- [Jest](https://facebook.github.io/jest/)
206+
- [Jest](https://jestjs.io/)
207207
- [Babel preset env](https://github.com/babel/babel-preset-env)

Diff for: docs/ja/guides/using-with-typescript.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Vue と TypeScript を一緒に使うためのセットアップの詳細は、
3030

3131
### Jest のセットアップ
3232

33-
Jest はバッテリー付属のユニットテストソリューションを提供するために Facebook が開発したテストランナです。 Jest の詳細については[公式ドキュメント](https://facebook.github.io/jest/) を参照してください。
33+
Jest はバッテリー付属のユニットテストソリューションを提供するために Facebook が開発したテストランナです。 Jest の詳細については[公式ドキュメント](https://jestjs.io/) を参照してください。
3434

3535
Jest と Vue Test Utils をインストールします。
3636

@@ -154,4 +154,4 @@ describe('HelloWorld.vue', () => {
154154
### リソース
155155

156156
- [この記事のサンプルプロジェクト](https://github.com/vuejs/vue-test-utils-typescript-example)
157-
- [Jest](https://facebook.github.io/jest/)
157+
- [Jest](https://jestjs.io/)

Diff for: docs/ja/guides/using-with-vuex.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('Actions.vue', () => {
9595

9696
次に、新しい `Vuex.store` をモックした値で呼び出すことによってモックのストアを作成します。それをアクションに渡すだけです。それが気にしなければならないことの全てだからです。
9797

98-
アクションは、[Jest のモック関数](https://facebook.github.io/jest/docs/en/mock-functions.html)です。これらモック関数は、アクションが呼び出されたかどうかを検証するメソッドを提供します。
98+
アクションは、[Jest のモック関数](https://jestjs.io/docs/en/mock-functions.html)です。これらモック関数は、アクションが呼び出されたかどうかを検証するメソッドを提供します。
9999

100100
アクションのスタブが期待どおりに呼び出されたことを検証することができます。
101101

0 commit comments

Comments
 (0)