Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Dive into vue-test-utils ~~Road of 1.0.0~~
Search
pipopotamasu
June 24, 2019
Technology
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Dive into vue-test-utils ~~Road of 1.0.0~~
pipopotamasu
June 24, 2019
More Decks by pipopotamasu
See All by pipopotamasu
How JS Works
pipopotamasu
0
230
vue-function-tester
pipopotamasu
2
1.3k
medpacker_introduction_20190523
pipopotamasu
0
540
Introduction of medpacker: RoR Frontend Boilerplate
pipopotamasu
0
5.1k
新サービス・JOURNAL(ジャーナル)開発秘話
pipopotamasu
2
310
メドピアにおけるライブラリアップデート_MedBeer_20180912.pdf
pipopotamasu
0
12k
MedPeer_JapaxTaxi_MeetUp_Actioncable
pipopotamasu
0
740
MedPeer X みんなのウェディング合同勉強会
pipopotamasu
0
1.2k
UXBridge_vol3_pipopotamasu
pipopotamasu
2
940
Other Decks in Technology
See All in Technology
GuardDuty 検知対応を DevOps Agent で効率化しようとしている話 / GuardDuty Investigations with DevOps Agent
masahirokawahara
1
280
JAWS-UG初心者支部#88わいわい初心塾(夏休みの宿題やったかGit編)
otsuki
0
120
データエンジニアリングワークショップ:Auto LoaderとSparkで学ぶデータパイプライン構築
databricksjapan
PRO
0
140
Redmine 7.0で私が開発した新機能の狙いと背景
vividtone
1
110
全社に広がるMCPサーバーを、 どう安全に管理するか MCPass開発の舞台裏
mtpooh
3
280
[RSJ26] Building a VLA Model Based on Self-Distilled Classification
keio_smilab
PRO
0
190
AI-DLCって実際どう? 〜聞きたいこと全部聞いてみる〜
news_it_enj
0
220
AIエージェントの開発・提供におけるセキュリティリスクの論点と対策
flatt_security
1
560
[RSJ26] NarrativeFlow: Flow-Based Vision-Language-Action Model Using Robot Velocity Fields
keio_smilab
PRO
0
150
作り直せるコードは迅速に 作り直せないDBは慎重に - AI時代のプロダクトエンジニアが「判断の不可逆性」で開発速度を変える話
kinosuke01
0
210
AI時代に、プロダクトの数だけ積み上がる所有コストをどうエンジニアリングするか / Engineering the Cost of Ownership
kzkmaeda
0
960
【視聴者参加型!】AWSセキュリティアンチパターンクイズ
syoshie
0
320
Featured
See All Featured
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
290
A better future with KSS
kneath
240
18k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
520
Unsuck your backbone
ammeep
672
58k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Fireside Chat
paigeccino
42
4k
We Have a Design System, Now What?
morganepeng
55
8.3k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Making Projects Easy
brettharned
120
6.7k
Music & Morning Musume
bryan
47
7.4k
Mobile First: as difficult as doing things right
swwweet
225
10k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Transcript
Dive into vue-test-utils ~~ Road of major 1.0.0 ~~ Yamato
Murakami (@pipopotamasu3) Vue.js Tokyo Drinkup#3 06/24/2019
name: Yamato Murakami, github: pipopotamasu, twitter: pipopotamasu3, company: MedPeer, Inc,
tech: [ Ruby, PHP, Vue.js, React ], hobby: Baseball
Do you know vue-test-utils?
So, what is medpacker? https://github.com/vuejs/vue-test-utils
So, what is medpacker? vue-test-utils is … vue-test-utils is the
“official” unit testing library for Vue.js
Have you used vue-test-utils?
None
None
None
None
None
Why has this been still beta?
Lets’s find out reasons!
https://github.com/vuejs/vue-test-utils/issues/246
https://github.com/vuejs/vue-test-utils/issues/246
2 blockers for ver1.0.0 *NQSPWFTVQQPSUGPSFYUFOEFEDPNQPOFOUT 'JYTZODISPOPVTCVHT
2 blockers for ver1.0.0 *NQSPWFTVQQPSUGPSFYUFOEFEDPNQPOFOUT 'JYTZODISPOPVTCVHT
Improve support for extended component
extended components?
extended components? // use Vue.extend const BaseComponent = Vue.extend({ data
() { return { lastname: 'murakami' } } }) new BaseComponent({ el: '#app', template: '<span>{{ firstname }}-{{ lastname }}</span>', data () { return { firstname: 'yamato' } } })
extended components? // use extends property const BaseComponent = {
data () { return { lastname: 'murakami' } } } new Vue({ extends: BaseComponent, el: '#app', template: '<span>{{ firstname }}-{{ lastname }}</span>', data () { return { firstname: 'yamato' } } });
Test Code
extended components? const BaseComponent = Vue.extend({ data () { return
{ lastname: 'murakami' } } }) const ChildCompoent = BaseComponent.extend({ template: '<span>{{ firstname }}-{{ lastname }}</span>', data () { return { firstname: 'yamato' } } }) describe("ChildCompoent.vue", () => { it("renders fullname", () => { const wrapper = mount(ChildCompoent); expect(wrapper.text()).toMatch('yamato-murakami'); }); });
extended components?
None
Why extended components need to improve?
None
None
None
// use Vue.extend const BaseComponent = Vue.extend({ data () {
return { lastname: 'murakami' } } })
// use Vue.extend const BaseComponent = Vue.extend({ data () {
return { lastname: 'murakami' } } }) !
None
// use Vue.extend const BaseComponent = Vue.extend({ data () {
return { lastname: 'murakami' } } }) BaseComponent.extend({ ~~~~~~~~~ some extend setting ~~~~~~~~~ })
// use Vue.extend const BaseComponent = Vue.extend({ data () {
return { lastname: 'murakami' } } }) BaseComponent.extend({ ~~~~~~~~~ some extend setting ~~~~~~~~~ }) "
None
https://github.com/vuejs/vue-test-utils/blob/dev/ packages/create-instance/create-instance.js#L76
None
https://github.com/vuejs/vue-test-utils/pull/1055
Why call `extend` twice?
Why call `extend` twice? const Component = { template: '<span></span>',
computed: { returnZero () { return 0; } } } describe("Component.vue", () => { it("override", () => { const wrapper = mount(Component, { computed: { returnZero () { return 'Override!!' } } }); expect(wrapper.vm.returnZero).toBe('Override!!'); }); });
5PJOKFDUDPNQPOFOUPQUJPOT MJLFADPNQVUFEAGSPNPVUTJEF
None
2 blockers for ver1.0.0 *NQSPWFTVQQPSUGPSFYUFOEFEDPNQPOFOUT 'JYTZODISPOPVTCVHT
2 blockers for ver1.0.0 *NQSPWFTVQQPSUGPSFYUFOEFEDPNQPOFOUT 'JYTZODISPOPVTCVHT
None
Thank you for listening!
References • https://github.com/vuejs/vue-test-utils • https://jp.vuejs.org • https://github.com/vuejs/vue
Reference Images • http://hermie.jp/ • Yoshiki HAYAMA hermie.jp • CC
BY 3.0 • https://creativecommons.org/licenses/by/ 3.0/deed.ja