Git Product home page Git Product logo

Comments (7)

tleunen avatar tleunen commented on May 18, 2024

Not sure to understand what the issue is. You said file.test.js had foobar translated to ../../foobar, which causes an issue. And then you're asking to have require.resolve('foobar') to be translated to ../../foobar. Which is the same thing, right?

from babel-plugin-module-resolver.

tleunen avatar tleunen commented on May 18, 2024

Oh nvm, I misread it.
You're saying the jest test file is not updated with new paths ;)

Hmm.. instead of using require.resolve(), which people won't really use.. Why having a custom syntax for your tests? I'd prefer having a "updateJestMock" option to convert jest.mock(X) to the relative path.

What do you think?

from babel-plugin-module-resolver.

sheerun avatar sheerun commented on May 18, 2024

that might work :) but it's probably issue not only with jest but also other mocking frameworks

from babel-plugin-module-resolver.

tleunen avatar tleunen commented on May 18, 2024

Sure, but I prefer having a custom setting by framework then than having to force people using a different syntax for their tests ;)

from babel-plugin-module-resolver.

arcanis avatar arcanis commented on May 18, 2024

Oh, that's a shame, being able to use require.resolve would have helped me in my case too (I don't use jest, and I use it with a simple readFileSync call which module-resolve probably shouldn't automatically transform) :( If you want to support extra frameworks I can see the reasoning, but shouldn't native functions be supported as well?

from babel-plugin-module-resolver.

tleunen avatar tleunen commented on May 18, 2024

I believe we can also add support for require.resolve. Would you mind creating a new ticket for that?

from babel-plugin-module-resolver.

arcanis avatar arcanis commented on May 18, 2024

Sure (#126)

from babel-plugin-module-resolver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.