Giter Club home page Giter Club logo

Comments (11)

felixjb avatar felixjb commented on May 26, 2024 1

Hello! I'm sorry for taking so long to respond. I'll take a look into it and come back with an answer

from testify.

briancavalier avatar briancavalier commented on May 26, 2024 1

Hey @felixjb, thanks for looking into it. If the parser does have access to __filename and identifier.name, that sounds like it could be a perfect fit for our use case.

I probably won't have time until at least the weekend, but if I do start working on something, I'll let you know.

I don't think it's possible to evaluate a variable or template string to get a test name to execute te command on the terminal

That makes perfect sense. I just noticed that testify ultimately uses mocha's fgrep to specify which tests to run, so I can see why it'd need access to the fully evaluated description string.

from testify.

felixjb avatar felixjb commented on May 26, 2024 1

Hello @briancavalier

Just letting you know that I haven't forgotten this. I am trying to make time to work on it but I haven't gotten any yet.

from testify.

briancavalier avatar briancavalier commented on May 26, 2024 1

Hey @felixjb, I really appreciate all your research and communication on this. It's a bummer for now, but I completely understand. I'll look forward to a future version that uses those new VSCode features 😄

Thanks again for looking into it and for testify!

from testify.

briancavalier avatar briancavalier commented on May 26, 2024

I'd be happy to submit a PR if you decide this is a reasonable feature to add, @felixjb.

from testify.

felixjb avatar felixjb commented on May 26, 2024

Hi @briancavalier , here's what I found:

During transpilation I don't think it's possible to evaluate a variable or template string to get a test name to execute te command on the terminal. However, apparently, the __filename and identifier.name are things that could be available to the parser during transpilation.

I'll try to work on it during this week but probably will have more time during next week.

Feel free to open a PR if you feel comfortable enough!

from testify.

briancavalier avatar briancavalier commented on May 26, 2024

Thanks for the update, @felixjb

from testify.

felixjb avatar felixjb commented on May 26, 2024

@briancavalier I just found out that the VSCode API has now some new features regarding testing. I think I am going to spend some time learning how to use them. Maybe we'll be able to do better with this feature, who knows.

from testify.

briancavalier avatar briancavalier commented on May 26, 2024

Sounds good, @felixjb

from testify.

felixjb avatar felixjb commented on May 26, 2024

Hello @briancavalier

After some research and testing I got to the conclusion that this feature cannot be implemented, at least not without some major changes in the project.

Quick recap for anyone who comes looking into this the future:

Testify, as it is now (version 1.9.0), uses Babel parser to parse the source code and find any tokens related to test frameworks, like describe and test. Then, with the location of these tokens in the file and the value of the title argument of these test function calls, which is a StringLiteral, it opens a new terminal and sends a command to execute the test with the local test framework. This command filters the tests in the codebase by using an argument that takes the title of the test.

During the parsing of the file, Babel, as far as I know, cannot evaluate a variable, like __filename, and return its value. It also cannot evaluate a TemplateString. Without a test name, Testify cannot execute the command to run that specific test.

Now for the good news:

VSCode release a native API for working with tests and I think there are some good opportunities there. However, this may require some rework in our project, which I am willing to do, but will take some time. Until then, feel free to reach out! Maybe I'll make more use of the discussions section on this repo.

from testify.

felixjb avatar felixjb commented on May 26, 2024

You're welcome! And you're always welcome to open new issues and pull requests!

from testify.

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.