Coder Social home page Coder Social logo

Comments (7)

skovhus avatar skovhus commented on May 31, 2024

Thanks for reporting this. : )

Do you want to work on a PR for this?

from jest-codemods.

WebDevMichael avatar WebDevMichael commented on May 31, 2024

Yes I would like to give it a try 😉

from jest-codemods.

skovhus avatar skovhus commented on May 31, 2024

Sound good. Let me know if you need any help. : )

from jest-codemods.

WebDevMichael avatar WebDevMichael commented on May 31, 2024

src/transformers/chai-should.js:406
On this line node.type equals Identifier, the condition passes if node.type equals ObjectExpression. I want the if condition to pass so we can surround the constant with Object.keys. Do you have a suggestion for this?

I already added tests in my fork: WebDevMichael@39dbb22

from jest-codemods.

skovhus avatar skovhus commented on May 31, 2024

It sounds right to me.

from jest-codemods.

WebDevMichael avatar WebDevMichael commented on May 31, 2024

How can I see if the Identifier (constant JSON object) is of the type ObjectExpression?
Because Identifier can also be any other possible variable, i.e. an array.

from jest-codemods.

skovhus avatar skovhus commented on May 31, 2024

So that is the challenging part.

Short answer: you can't.

Longer answer: if the identifier is assigned inside the file you can search the AST for assignment to this specific identifier... But it might be assigned multiple places. AND the identifier might be defined in another file.

I cases like this, I do a best guess and log a warning that the transformation might not be right.

from jest-codemods.

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.