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

198
Views
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
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!