Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

335
Vistas
Cannot create component with shallowMount, vm.$refs['VTU_COMPONENT'] is not defined

Not sure if it is a bug or If I'm doing something wrong.

I try to mount my main App component with shallowMount but it doesn't works. I get the following error message:

Cannot set properties of undefined (setting 'hasOwnProperty')

It happens when vue-test-utils try to mount the App Component:

...
var appRef = vm.$refs[MOUNT_COMPONENT_REF];
// we add `hasOwnProperty` so jest can spy on the proxied vm without throwing
appRef.hasOwnProperty = function (property) {
    return Reflect.has(appRef, property);
};
console.warn = warnSave;
var wrapper = createVueWrapper(app, appRef, setProps);
trackInstance(wrapper);
return wrapper; 
...

Here, MOUNT_COMPONENT_REF equals 'VTU_COMPONENT' and vm.$refs[MOUNT_COMPONENT_REF] isn't defined.

Minimal example

It is available online : https://codesandbox.io/s/prod-glitter-tnoyqt?file=/src/App.spec.js

App.vue

<template>
  <div id="a-test">
    {{ test }}
  </div>
</template>

<script>
export default {
  name: "App",
};
</script>

App.spec.js

import { shallowMount } from "@vue/test-utils";
import App from "@/App";

describe("App.vue", () => {
  test("Test that fails", async () => {
    const wrapper = shallowMount(App);
  });
});
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

fixed if I upgrade to @vue/test-utils 2.0.0-rc.21

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda