Deep merge in tests setup #2747
souellet13
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
We currently have Vue2 tests that we are migrating to Vue3.
Here's an example of a global setup and our mountFunction function that we use to get our wrappers:
`beforeEach(() => {
const defaultOptions = {
global: {
mocks: {
$t: defaultServiceMock["$t"],
$te: defaultServiceMock["$te"],
},
plugins: [vuetifyTesting],
stubs: {
"v-list": defaultComponentStubs["VList"],
"v-list-item": defaultComponentStubs["VListItem"],
},
},
props: {
associationsEvaluations: [],
composante: qualite.composantes[0],
evaluationsWithCriteresCorrection: EVALUATION_LIST,
indicateur: qualite.composantes[0].indicateurs[0],
qualite: qualite,
},
}
})`
In the tests, we use:
const wrapper = mountFunction(shallowMount)My question is the following: Is is a bad practice to use the deepMerge here? Could it cause issues?
We were getting the following warning because we had a call to mountFunction in a beforeEach, then a second call in a specific test with a slightly different setup:
[Vue warn]: Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.
I wonder if the issue is just the way our tests are setup or if the merge is also problematic.
Any idea?
Beta Was this translation helpful? Give feedback.
All reactions