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
72
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
58
PostCSS 與 cssnext
julian7454
0
97
javascript品質檢測工具 - ESLint
julian7454
0
160
Featured
See All Featured
BBQ
matthewcrist
89
9.7k
Speed Design
sergeychernyshev
32
1k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
810
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
950
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.6k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Side Projects
sachag
455
42k
Designing for Performance
lara
610
69k
Balancing Empowerment & Direction
lara
1
410
Docker and Python
trallard
44
3.5k
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