Skip to content

Migrate emoji_menu_spec.js to Jest

Inactive Account requested to merge winh-emoji-menu-jest into master

What does this MR do?

This moves emoji_menu_spec.js to Jest and configures Jest to fail long running tests.

It reduces the time running emoji_menu_spec.js individually takes to less than half:

yarn karma -f spec/javascripts/pages/profiles/show/emoji_menu_spec.js yarn jest spec/frontend/pages/profiles/show/emoji_menu_spec.js
yarn run v1.12.0
$ BABEL_ENV=${BABEL_ENV:=karma} karma start --single-run true config/karma.config.js -f spec/javascripts/pages/profiles/show/emoji_menu_spec.js
ℹ 「wdm」:
ℹ 「wdm」: Compiled successfully.
10 12 2018 13:01:20.149:INFO [karma]: Karma v3.0.0 server started at http://0.0.0.0:9876/
10 12 2018 13:01:20.154:INFO [launcher]: Launching browser ChromeHeadlessCustom with unlimited concurrency
10 12 2018 13:01:20.205:INFO [launcher]: Starting browser Chrome
10 12 2018 13:01:22.624:INFO [Chrome]: Connected on socket nDMjSnyeJrumO0rlAAAA with id 75176442
Chrome: Executed 9 of 9 SUCCESS (0.135 secs / 0.127 secs)
TOTAL: 9 SUCCESS
✨  Done in 10.88s.
yarn run v1.12.0
$ BABEL_ENV=jest jest spec/frontend/pages/profiles/show/emoji_menu_spec.js
 PASS  spec/frontend/pages/profiles/show/emoji_menu_spec.js
  EmojiMenu
    addAward
      ✓ calls selectEmojiCallback (66ms)
      ✓ does not make an axios requst (13ms)
    bindEvents
      ✓ binds event listeners to custom toggle button (1ms)
      ✓ binds event listeners to custom menu class (1ms)
    createEmojiMenu
      ✓ renders the menu with custom menu class (8ms)

Test Suites: 1 passed, 1 total Tests: 5 passed, 5 total Snapshots: 0 total Time: 1.086s, estimated 2s Ran all test suites matching /spec/frontend/pages/profiles/show/emoji_menu_spec.js/i. ✨ Done in 3.98s.

What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ce/issues/53757

Does this MR meet the acceptance criteria?

Edited by Inactive Account

Merge request reports