Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
How to Ace a Technical Interview
jacobian
280
24k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.4k
The Invisible Side of Design
smashingmag
302
51k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Balancing Empowerment & Direction
lara
5
790
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
What's in a price? How to price your products and services
michaelherold
246
13k
Done Done
chrislema
186
16k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
[RailsConf 2023] Rails as a piece of cake
palkan
58
6.2k
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