Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

201
Views
Jest test vuex state was overridden by a module with the same name

I'm testing an application with vuex, I have a main store and a module, everything works fine in the application itself, but when I use tests I get a warning.

console.warn [vuex] state field "institutes" was overridden by a module with the same name at "institutes"

main store

export const state = {}

export default new Vuex.Store({
  state,
  mutations,
  actions,
  getters,
  modules: {
     institutes
 }
})

secondary store

export const stateInst = {}

export default {
  namespaced: true,
  state: () => stateInst,
  mutations,
  actions
}

test.spec.js

import Vuex from "vuex"
import {mount, createLocalVue} from "@vue/test-utils"
import Institutes from '../../assets/src/components/Institutes'
import { state } from '../../assets/src/store/index'
import { stateInst } from '../../assets/src/store/institutes-store'

const localVue = createLocalVue()
localVue.use(Vuex)

describe('testing component', () => {
let store
 beforeEach(() => {
  store = new Vuex.Store({state,
        modules: {
            institutes: {
                namespaced: true,
                state: () => stateInst,
                mutations,
                actions,
            }
        }
    })
})
 test('some test', async () => {
    const wrapper = mount(Institutes, {
        store, localVue
    })
  })
})

I tried to follow the advice as given in the documentation but it either doesn't work or breaks my application. enter link description here

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!