Coder Social home page Coder Social logo

Issue with AVA codemod about jest-codemods HOT 10 CLOSED

skovhus avatar skovhus commented on May 31, 2024
Issue with AVA codemod

from jest-codemods.

Comments (10)

xjamundx avatar xjamundx commented on May 31, 2024

No need to fix it for me or anything, but just a heads up.

from jest-codemods.

xjamundx avatar xjamundx commented on May 31, 2024

It turns it fails even without the promise

import test from 'ava'

test('should pass', t => {
    shouldFail(t, 'hi')
})

function shouldFail(t, message) {
    t.same('error', message)
}

from jest-codemods.

skovhus avatar skovhus commented on May 31, 2024

Thank you so much for sharing the code examples here. I'll look into a fix.

Did it work for you on the rest of the codebase?

from jest-codemods.

xjamundx avatar xjamundx commented on May 31, 2024

There were some issues, so like the default paths don't work. The only seem to work when I type them from the command line.

jest-codemods public/js/**/__tests__/*.js works
jest-codesmods without a path does not work (even if I type the path during the command step). It just says it can't find any of my files.

I assume that's something to do with how you process paths vs. how the OS does it for you. Anyway, not a big deal.

Also had some issues installing globally, so i was just running it locally from ./node_modules/.bin/jest-codemods

So far so good, not all the tests that transpiled are passing, but it's helping a lot

from jest-codemods.

skovhus avatar skovhus commented on May 31, 2024

Thank you for sharing, I really appreciate it! : )

Based on your example I found some issues with how t properties were parsed. It should now be more stable now. And also handle AVA t.same and other deprecated AVA properties that I overlooked. fd5e

Can you give 0.2.4 a spin?

As for the problem with global installment, which version did you try? Maybe you can try out 0.2.4 and see if you have the same problem.

Thanks!

from jest-codemods.

skovhus avatar skovhus commented on May 31, 2024

Version 0.2.5 should fix your issue with globs not working when not providing a path.

from jest-codemods.

xjamundx avatar xjamundx commented on May 31, 2024

awesome! trying them now

On Fri, Sep 30, 2016 at 4:23 PM, Kenneth Skovhus [email protected]
wrote:

Version 0.2.5 should fix your issue with globs not working when not
providing a path.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPBf2j23yoP5W5UjhlAkQw8NKx7ezK-ks5qvZoFgaJpZM4KLacR
.

from jest-codemods.

skovhus avatar skovhus commented on May 31, 2024

There is still some issues with not removing t for the case where you are passing it to a function.

Example:

import test from 'ava'

test('should pass', t => {
    shouldFail(t, 'hi')
    return shouldFail2(t, 'hi')
})

function shouldFail(t, message) {
    t.same('error', message)
}

function shouldFail2(t, message) {
    return Promise.reject().catch(err => {
        t.same(err.message, message)
    })
}

Currently converts to

it('should pass', () => {
    shouldFail(t, 'hi')
    return shouldFail2(t, 'hi')
})

function shouldFail(t, message) {
    expect('error').toEqual(message)
}

function shouldFail2(t, message) {
    return Promise.reject().catch(err => {
        expect(err.message).toEqual(message)
    })
}

Notice that t is undefined. It should either be removed or replaced with Jasmines done function.

from jest-codemods.

xjamundx avatar xjamundx commented on May 31, 2024

cool, this is more than enough to get us started thanks!

from jest-codemods.

skovhus avatar skovhus commented on May 31, 2024

@xjamundx let me know if you find other bugs. : )

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.