Refactor unit test report to use namespaced vuex module
What does this MR do and why?
For #363076 (closed)
This MR refactors the vuex store for the unit test report (the Tests
tab on the pipeline page) to make it into a namespaced module in preparation for #360794 (closed).
-
The Vuex store should be created in the app's entry point rather than its store/index.js
file.-
Move Vue.use(Vuex)
to the app's entry point. -
store/index.js
only returns the store's options. -
The store is instantiated with new Vuex.Store
in the entry point.
-
-
The stores should be converted to namespaced modules. -
In store/index.js
, place all options into a namespaced module. -
Optionally, move state, actions, mutations and getters files to a sub-directory. -
Review all map*
helper usages so that they properly map to the module rather than the root.
-
-
The app's root component should register its module(s) in the created
hook. This can be done with theregisterModule
method. More on this in https://vuex.vuejs.org/guide/modules.html#dynamic-module-registration. -
app's entry point:
app/assets/javascripts/pipelines/pipeline_test_details.js
-
store index:
app/assets/javascripts/pipelines/stores/test_reports/index.js
-
app's root component:
app/assets/javascripts/pipelines/components/test_reports/test_reports.vue
Screenshots or screen recordings
No visual changes are expected, but here's the tab:
How to set up and validate locally
git checkout 363076-unit-test-report-to-vuex-module
- find/clone a project with unit test reports
- run a pipeline in the project to generate a test report for the tab to display
- navigate to the pipeline, click on the
Tests
tab - everything should work exactly the same as it does on
master
- the test summary should load, you should be able to click on each suite and see its tests, there should be a spinner when the suite is loading, there should be an empty state if there are no tests, etc.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.