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
Vue testing library - avoriaz
Search
julian7454
May 05, 2017
0
75
Vue testing library - avoriaz
julian7454
May 05, 2017
Tweet
Share
More Decks by julian7454
See All by julian7454
Vue 2.0 開發環境 - 以 webpack2 建立
julian7454
0
76
houdini drafts
julian7454
0
62
PostCSS 與 cssnext
julian7454
0
98
javascript品質檢測工具 - ESLint
julian7454
0
170
Featured
See All Featured
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
9
590
GraphQLとの向き合い方2022年版
quramy
49
14k
Gamification - CAS2011
davidbonilla
81
5.5k
Keith and Marios Guide to Fast Websites
keithpitt
411
23k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
900
4 Signs Your Business is Dying
shpigford
185
22k
Facilitating Awesome Meetings
lara
56
6.6k
Bash Introduction
62gerente
615
210k
Documentation Writing (for coders)
carmenintech
75
5.1k
Unsuck your backbone
ammeep
671
58k
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.9k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.1k
Transcript
Vue testing library avoriaz PIXNET 獮ᒒ奲ֺ䨝 2017/02/05 Julian 1
墋ฃጱ㻌ز介手 2
Test framework • Test framework (Mocha, jasmine, jest, etc …)
• Mocha ䷱磪䥁牧襑砇蟴 Chai ٌ犢ॺկ • Jasmine(2.x) === Mocha + Chai + Sinon - mockserver 3
Test framework 4
headless browser • headless browser (PhantomJS, jsdom) • 蝧ଶ斃盠牧֕穉斃櫞ਠ獊秇硈፥䋿眐୵ 5
Test Runner • Test Runner (Karma, Selenium) • 蝚螂倵薩瑊薪疗 •
karma.config.js 6
Vue 介手 • Vue-cli: karma + Mocha + Nightwatch (e2e)
• ᛔᤈ蟴ᗝ Mocha-webpack + Mocha + chai 7
ਞ蕕 • npm install --save-dev mocha chai • npm install
mocha-webpack … etc ٌ犢 es6 翥捌ፘ 橕 • npm run test 8 • package.son
avoriaz • a Vue.js testing utility library • 秇硈Ԫկ藉咳 •
ොጱ䥁獢ୗ䓚 • 砺֢ৼزկ 9 • https://github.com/eddyerburgh/avoriaz
avoriaz 10 • https://github.com/eddyerburgh/avoriaz • ׀膏ݱ圵介手瑊膏礍ጱ蟴ᗝ塅ֺ
avoriaz • npm install —save-dev avoriaz jsdom • jsdom 秇硈
Dom 奾䯤 11 • package.son • .setup
avoriaz • ڡত玕物 const wrapper = mount(Foo, { options });
12
avoriaz api • mount • use 13
mount • contains (selector) • 嘦藨ݑ玽۱珀瞲ਧৼزկ selector 牧ࢧ㯽独 14
mount • find(selector) • ࢧ㯽ৼ℄讨 vue component array 15
mount • simulate(eventName) • Ԫկ藉咳 16
mount 17 • computed() • data() • methods() • instance()
• hasStyle() • etc …
use 18 • 獈ٌ犢 vue ॺկ牧ֺই vuex
綡㺔 • propsData, setData, update 缛ݢ犥虋矦 component ጱොဩฎ玽螕ݳֵአ 19
奾抷 • 琲手疩獈介手ૡٍ虏介手ݢ犥ๅฃᤩ䁆ᤈ 20
㷢ᘍ • How to unit test Vue components • https://github.com/eddyerburgh/avoriaz
• avoriaz github • https://github.com/eddyerburgh/avoriaz • ቘ薹獮ᒒݎӾጱunit test e2e test • https://tech.colla.me/zh/show/ understanding_unit_test_and_e2e_test_in_frond_end_development 21