-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
CLI running tests filtered by line does not work anymore #3049
Comments
The example works locally. Looking at the stack trace that is printed, it contains HTTPS URLs. AVA is not expecting that. Probably ava/lib/worker/line-numbers.js Lines 105 to 110 in 3f17f8c
Are you running into this locally or really are you asking about your TypeScript project? If you modify this line it should contain more details: Line 222 in 3f17f8c
|
TBH I try to write a CodeLens for VSC extension that run test case from given line. For now, I tried this command with two TS projects I have, but maybe I should try with plain JS project 🤔 After unsuccessful runs I moved to the documentation sample - which works in BTW, I've run this in debug mode and find out in event message: |
We parse the source here: ava/lib/worker/line-numbers.js Lines 14 to 18 in 3f17f8c
I wouldn't expect that specific error coming out of that code… The implementation is meant to handle JS files. The way this works for TypeScript (with I don't know how any dynamic compilation with |
The exception comes right from the code you highlighted. But only for the TS project. I just verified it on new clean JS project and filter with line numer works fine 👍 Thank you for the help :) I think I just open a new discussion, as you mentioned here. Not sure - but this report could be closed or do you think that we need some outcome from it: like removing the stackblitz sample from the docs or just mention there that it works 'online' only for the version < |
That does sound like a bug. That's locally / in CI right, not with StackBlitz? Do you have a reproduction you could share?
There's a PR for updating the examples so I've mentioned it there: #3017 (comment) |
That is right: it is locally. I try to prepare a sample project and if I won't be able - I try to send an invitation to the private repo - this one I can share :) Just give me some time 🙏 |
So I have two sample projects:
Also I send you an invitations to the organisation and the repository inside it. The repo is like a monorepo. Could you One of the test is placed in npx ava --verbose /Users/sculpt0r/projects/engine/src/backend/system/controller-selector.test.ts:47 Please notice I changed the ava/lib/worker/line-numbers.js The exception detail indicates to: class FakeAuthorizer implements IAuthorizer { The above class is declared in test file, because it is used as a mock of real dependency to solve auth in the app. Right now I'm not sure if my troubles comes from invalid TS + AVA setup? If you need additional logs or sth - just let me know. |
I haven't had a chance yet to look into this. |
This feature works fine for JS project, but not for TS. I'm able to run test file with AVA, but AVA is unable to find any test if the same file is filtered by line number. To makes thing easier I added the line filter to ava test runner. Then I tried it on TS project with & without precompilation with the same results |
@sculpt0r there's a bug in how the source map is applied for your For the larger project you shared last month, the problem is that the parser chokes on the Even with I'll open some follow-up issues as well as a PR to fix the bug and report the parser error. |
According to docs: https://github.com/avajs/ava/blob/main/docs/05-command-line.md#running-tests-at-specific-line-numbers it is possible to run a specific test by line number.
Please open the StackBlitz linked in the documentation. It should work fine. Then, change the AVA version to
4.3.0
inpackage.json
. Instal withnpm i
and try to run the test again withnpm run test
. Now there is an error in the StackBlitz terminal:Also, in a different project with TS, when I tried to run a test with a line filter, I received only some generic information:
It would be good to provide some more output to the console - because right now I don't know the reasons why the file can't be parsed? Without the line filter - tests in the file work fine 🤔
The text was updated successfully, but these errors were encountered: