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

191
Vistas
How to use absolute path in enzyme

I use Enzyme and React 17.0.2 together

jsconfig.json

{
    "compilerOptions": {
        "baseUrl": "src"
    },
    "include": [
        "src"
    ]
}

enzymeConfig.js

import { configure } from "enzyme";
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";

configure({ adapter: new Adapter() });

Login.test.js

import React from "react";
import { mount } from "enzyme";
import '../../enzymeConfig';
import Login from "components/Layout/Login/FormSide/Login";

describe('Test login form', () => {
    let wrapper;

    it("Username created correctly.", function () {
        wrapper = mount(<Login />);
        wrapper.find('input[type="text"]').simulate("change", {
            target: { value: 'something' }
        });
        expect(wrapper.state("username")).toEqual("world");
    });
});

I use absolute path in react and I haven't issue But in Enzyme I get the following error:

Cannot find module 'components/Layout/Login/FormSide/Login' from 'src/__tests__/Login.test.js'

How can i use absolute path in Enzyme?

about 4 years ago · Juan Pablo Isaza
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