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
73
Vue testing library - avoriaz
julian7454
May 05, 2017
Tweet
Share
More Decks by julian7454
See All by julian7454
Vue 2.0 開發環境 - 以 webpack2 建立
julian7454
0
74
houdini drafts
julian7454
0
59
PostCSS 與 cssnext
julian7454
0
97
javascript品質檢測工具 - ESLint
julian7454
0
160
Featured
See All Featured
Making Projects Easy
brettharned
117
6.4k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
61k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.1k
Typedesign – Prime Four
hannesfritz
42
2.8k
A designer walks into a library…
pauljervisheath
207
24k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
Navigating Team Friction
lara
189
15k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
What's in a price? How to price your products and services
michaelherold
246
12k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
112
20k
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