質問編集履歴

5

部分的に正解が判明したので、それに従って修正

2018/01/09 06:44

投稿

1ntegrale9
1ntegrale9

スコア98

test CHANGED
File without changes
test CHANGED
@@ -86,7 +86,7 @@
86
86
 
87
87
  const vm = new Vue(Target).$mount()
88
88
 
89
- expect(vm.methods.test()).toBe('test')
89
+ expect(vm.test()).toBe('test')
90
90
 
91
91
  })
92
92
 
@@ -140,11 +140,21 @@
140
140
 
141
141
 
142
142
 
143
- vm.methods.test()ではなくvm.test()としてみるパターン
143
+ vm.test()ではなくvm.methods.test()としてみるパターン
144
144
 
145
145
  ```vue
146
146
 
147
- expect(vm.test()).toBe('test')
147
+ expect(vm.methods.test()).toBe('test')
148
+
149
+ ```
150
+
151
+
152
+
153
+ vm.test()ではなくvm.default.test()としてみるパターン
154
+
155
+ ```vue
156
+
157
+ expect(vm.default.test()).toBe('test')
148
158
 
149
159
  ```
150
160
 

4

誤植を修正

2018/01/09 06:44

投稿

1ntegrale9
1ntegrale9

スコア98

test CHANGED
File without changes
test CHANGED
@@ -59,6 +59,8 @@
59
59
  return 'test'
60
60
 
61
61
  },
62
+
63
+ }
62
64
 
63
65
  }
64
66
 

3

タグ順を並び替え

2018/01/09 06:39

投稿

1ntegrale9
1ntegrale9

スコア98

test CHANGED
File without changes
test CHANGED
File without changes

2

「発生している問題・エラーメッセージ」を更に詳細に

2018/01/09 01:53

投稿

1ntegrale9
1ntegrale9

スコア98

test CHANGED
File without changes
test CHANGED
@@ -14,6 +14,10 @@
14
14
 
15
15
 
16
16
 
17
+ 自動テストを実行すると、
18
+
19
+
20
+
17
21
  ```
18
22
 
19
23
  Target.vue
@@ -25,6 +29,14 @@
25
29
  at Context.it (webpack:///test/unit/specs/Target.spec.js:9:18 <- index.js:22935:29)
26
30
 
27
31
  ```
32
+
33
+
34
+
35
+ というエラーメッセージが発生します。
36
+
37
+ レンダリングと参照は問題なさそうなのですが、
38
+
39
+ test()が関数ではないと言われており、その原因が分かりません。
28
40
 
29
41
 
30
42
 

1

参考にしたリンクを追加

2018/01/09 01:12

投稿

1ntegrale9
1ntegrale9

スコア98

test CHANGED
File without changes
test CHANGED
@@ -146,6 +146,28 @@
146
146
 
147
147
 
148
148
 
149
+ また、以下の記事を参考にして試行錯誤を行いました。
150
+
151
+
152
+
153
+ [ユニットテスト · electron-vue](https://simulatedgreg.gitbooks.io/electron-vue/content/ja/unittesting.html)
154
+
155
+ [単体テスト — Vue.js](https://jp.vuejs.org/v2/guide/unit-testing.html)
156
+
157
+ [モックを使用したテスト · vue-loader](https://vue-loader.vuejs.org/ja/workflow/testing-with-mocks.html)
158
+
159
+ [Vue.js Vueコンポーネントのユニットテストを書いてみよう - Qiita](https://qiita.com/potato4d/items/8215941b84c11b845886)
160
+
161
+ [Vueコンポーネントのユニットテスト - SSSSLIDE](http://sssslide.com/speakerdeck.com/hypermkt/vuekonponentofalseyunitutotesuto)
162
+
163
+ [Vue.js の 単体テストについて、webpackなどビルドツールがない状況での環境を構築する - Qiita](https://qiita.com/TKR/items/c537f2cfd835311eeb37)
164
+
165
+ [vue-test-utilsでvuexモジュールのテストを書く - Qiita](https://qiita.com/_P0cChi_/items/41a0b84da924718f7c05)
166
+
167
+ [Vuexの状態を包括的にテストする - Qiita](https://qiita.com/renowan/items/f507b36207d5b3b01c17)
168
+
169
+
170
+
149
171
  ###補足情報(言語/FW/ツール等のバージョンなど)
150
172
 
151
173
  ライブラリ等は全て最新のものを使用しています。