Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
Transcript
48 slides
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
More Decks by pipopotamasu
See All by pipopotamasu
How JS Works
pipopotamasu
0
240
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
330
メドピアにおけるライブラリアップデート_MedBeer_20180912.pdf
pipopotamasu
0
12k
MedPeer_JapaxTaxi_MeetUp_Actioncable
pipopotamasu
0
750
MedPeer X みんなのウェディング合同勉強会
pipopotamasu
0
1.2k
UXBridge_vol3_pipopotamasu
pipopotamasu
2
940
Other Decks in Technology
See All in Technology
「任されビリティ」で引き受けて「よしなりてぃ」に頼らず任せる / Accept tasks with "makasarebility" and hand them over without relying on "yoshinarily"
pauli
0
140
狙われているAPIの脆弱性!今こそ手をつけるべき根本的な対策とは?
nagix
0
120
Quick Automate | 目指せ Quick マスター 12
inariku
PRO
1
100
ゼロから作るWebアプリの新定番!?Amplify Gen 2 × AWS Blocksで実現する「開発速度とRDBの柔軟性のいいとこ取り」
amixedcolor
1
250
AI時代における医療情報システムのセキュリティ / Security of Healthcare IT Systems in the AI Era
henryofficial
0
150
AWS基盤改善を支える 私たちの理念と行動指針
kentosuzuki
0
200
Kiro Crew の Bot (続く役目を任せる窓口) | 目指せ Kiro マスター 12
inariku
PRO
2
370
長い仕事を任せる (Workflows、クラウドセッション、Kiro Web) | 目指せ Kiro マスター 10
inariku
PRO
3
180
JAWSコミュニティに 参加して1年経った結果
ssakita
0
140
Datadog の権限統制 〜Org 統合に向けて調べた注意点 / JDDUG-Meetup_24
visional_engineering_and_design
1
100
Intro to Kiro (One agent, every surface) | Kiro: Zero to Hero 01
inariku
PRO
2
120
マネジメントされる側の仕事は「文句」を言うこと
riyaamemiya
2
200
Featured
See All Featured
Leo the Paperboy
mayatellez
11
2.5k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Abbi's Birthday
coloredviolet
5
11k
We Have a Design System, Now What?
morganepeng
55
8.4k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
480
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.4k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
610
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
900
Between Models and Reality
mayunak
4
570
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
990
What the history of the web can teach us about the future of AI
inesmontani
PRO
3
810
Automating Front-end Workflow
addyosmani
1370
210k