Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tape transformer should work with any variable name #152

Open
domoritz opened this issue Feb 16, 2019 · 2 comments
Open

Tape transformer should work with any variable name #152

domoritz opened this issue Feb 16, 2019 · 2 comments

Comments

@domoritz
Copy link

domoritz commented Feb 16, 2019

This is a feature request.

Conversion of this code works well but

var test = require('tape');

test('timing test', function (t) {
    t.plan(2);

    t.equal(typeof Date.now, 'function');
    var start = Date.now();

    setTimeout(function () {
        t.equal(Date.now() - start, 100);
    }, 100);
});

But this does not work (jest-codemods warning: (...) Argument to test function should be named "t" not "x").

var test = require('tape');

test('timing test', function (x) {
    x.plan(2);

    x.equal(typeof Date.now, 'function');
    var start = Date.now();

    setTimeout(function () {
        x.equal(Date.now() - start, 100);
    }, 100);
});

I think it would be great if the codemod supported arbitrary variable names.

@skovhus
Copy link
Owner

skovhus commented Feb 17, 2019

Good idea, but might be slightly tricky to find all the places where x is used. But I’m always open for PRs, and I’m happy to help if you are stuck.

@domoritz
Copy link
Author

domoritz commented Feb 17, 2019

I decided to rename all test variables but still thinn it would be good if this codemod was more robust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants