Comments (11)
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.
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.
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.
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.
I'd be happy to submit a PR if you decide this is a reasonable feature to add, @felixjb.
from testify.
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.
Thanks for the update, @felixjb
from testify.
@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.
Sounds good, @felixjb
from testify.
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.
You're welcome! And you're always welcome to open new issues and pull requests!
from testify.
Related Issues (20)
- No test runner in your project. Please install one. HOT 5
- Fix Enzyme Internal Error HOT 2
- Test file watchers that triggers edited tests HOT 1
- Regexp .test method triggers adding the "Run Test | Debug Test" HOT 3
- Keybindings to run tests
- Add codelens near context keyword
- there is a undefined in grep HOT 5
- Backslashes used for path to jest bin. Causes bad path when using Git Bash terminal on Windows HOT 3
- This experimental syntax requires enabling the parser plugin: 'optionalChaining' (55:12) HOT 1
- Monorepo support HOT 6
- Babel's typescript transpilation options HOT 1
- Incorrectly identifies identifier with name "it" as a test HOT 2
- Support for jest-each HOT 1
- Support playwright test runner HOT 1
- Double quotes should be escaped from the command HOT 2
- Playwright test debug fails with error HOT 7
- The automated release is failing 🚨 HOT 8
- Path is not used HOT 2
- "No test runner in your project. Please install one." error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testify.