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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
julian7454
May 05, 2017
0
76
Vue testing library - avoriaz
julian7454
May 05, 2017
Tweet
Share
More Decks by julian7454
See All by julian7454
Vue 2.0 開發環境 - 以 webpack2 建立
julian7454
0
77
houdini drafts
julian7454
0
64
PostCSS 與 cssnext
julian7454
0
99
javascript品質檢測工具 - ESLint
julian7454
0
170
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
304
21k
The Language of Interfaces
destraynor
162
26k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
57
50k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
120
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
120
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
The agentic SEO stack - context over prompts
schlessera
0
640
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
280
Amusing Abliteration
ianozsvald
0
100
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
590
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
61
52k
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