Skip to content

Migrate timeline_entry_item_spec.js to Jest

Inactive Account requested to merge winh-timeline-entry-jest into master

What does this MR do?

This moves timeline_entry_item_spec.js to Jest and adds the basic setup to test Vue with Jest.

Running the test file individually is now almost three times faster:

yarn karma -f spec/javascripts/vue_shared/components/notes/timeline_entry_item_spec.js yarn jest spec/frontend/vue_shared/components/notes/timeline_entry_item_spec.js
yarn run v1.12.0
$ BABEL_ENV=${BABEL_ENV:=karma} karma start --single-run true config/karma.config.js -f spec/javascripts/vue_shared/components/notes/timeline_entry_item_spec.js
ℹ 「wdm」:
ℹ 「wdm」: Compiled successfully.
10 12 2018 11:06:59.227:INFO [karma]: Karma v3.0.0 server started at http://0.0.0.0:9876/
10 12 2018 11:06:59.232:INFO [launcher]: Launching browser ChromeHeadlessCustom with unlimited concurrency
10 12 2018 11:06:59.240:INFO [launcher]: Starting browser Chrome
10 12 2018 11:07:02.932:INFO [Chrome]: Connected on socket j9lJSfcDUk2cGGAYAAAA with id 69047653
Chrome: Executed 6 of 6 SUCCESS (0.066 secs / 0.056 secs)
TOTAL: 6 SUCCESS
✨  Done in 12.65s.
yarn run v1.12.0
$ BABEL_ENV=jest jest --config=config/jest.config.js spec/frontend/vue_shared/components/notes/timeline_entry_item_spec.js
 PASS  spec/frontend/vue_shared/components/notes/timeline_entry_item_spec.js
  TimelineEntryItem
    ✓ renders correctly (29ms)
    ✓ accepts default slot (11ms)

Test Suites: 1 passed, 1 total Tests: 2 passed, 2 total Snapshots: 0 total Time: 1.671s, estimated 2s Ran all test suites matching /spec/frontend/vue_shared/components/notes/timeline_entry_item_spec.js/i. ✨ Done in 4.83s.

What are the relevant issue numbers?

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

Does this MR meet the acceptance criteria?

Edited by Inactive Account

Merge request reports