-
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
Error when running tests specifying an absolute path #643
Comments
I just tried running AVA "remotely", outside project folder, and it worked fine. Are you sure you imported |
@vdemedes, thanks for the reply!. My bad!, you're right, I was trying to say /Repositories/x/y.js. Anyway, after extending the tests, it's only happening outside the project folder, the detail of the absolute path was useless (sorry about that). I've tried with a couple of repos that contain ava tests. These files contain Maybe I have something wrong in my system. |
I've tried absolute paths and it works that way too. Could you please try using AVA's master branch instead of the version on npm? Here's the commands you need to run:
and inside project folder:
|
First and foremost, thanks for all the support @vdemedes. No joy :(. I've done:
I put the entire sequence to show that I installed from sindresorhus/ava, went into the project folder, deleted ava, installed again and repeated the test, in and outside. I don't know, seems to be something very strange. Btw, what I was trying to say before, is that I have just realised that the absolute path is a useless detail. At least for me, fails trying to run in a different folder (not the project). |
No worries, @jacobmendoza, it's too bad I can't reproduce this. Perhaps someone else might help with this. |
FWIW, I've run into this, too. I've done some debugging here, and this is what seems to be happening: My As a workaround, ensure that none of your |
In a separate conversation with @sindresorhus he confirmed that was able to reproduce and suggested this. Just in case it helps to understand the root of the issue. I'm very sorry that I forgot to copy this when opening the issue. I thought I did, but it seems that I completely missed it. |
Yes, I asked @jacobmendoza to open this. I can easily reproduce by running AVA with an absolute path from a project that already depends on AVA:
|
Wouldn't |
@novemberborn The global CLI just hands it directly off to the local AVA if available. |
Yes, so if you're in |
Yes, we should ensure the test files require the same AVA as used to fork the test files. |
That will be problematic across version boundaries. Maybe we should detect this scenario and refuse to run the tests? |
Actually, when thinking about it, the current behavior makes sense. It should always use the AVA version in the current directory. Instead, we should introduce a |
Instead of adding an option, what if we just check the provided patterns to see if they reference stuff outside of |
Is there a workaround for the time being? Experiencing the same issues as @jacobmendoza. sist output: OSDarwin - x64 node
Time created: Tue Jul 05 2016 20:55:11 GMT-0700 (PDT) |
To recap, when a globally installed AVA is launched it checks if there is a local AVA installation. If so it hands off to that installation, else the global AVA installation is used. Then for each test file AVA launches a child process. It starts a test worker inside the AVA module. This worker then requires the test file using an absolute path. It verifies the test file has required There are three ways this problem can occur:
The best solution would be for the test worker to set environment variable (on |
The main process sets the AVA_PATH environment variable to the absolute path of the index.js file. Workers are loaded with this variable present. When test files require the AVA module (assuming it's a version containing this commit of course), the index.js file redirects to the one used by the worker if necessary by comparing AVA_PATH. The redirect required most of index.js to be moved into a separate module (lib/main.js). Fixes #643.
The main process sets the AVA_PATH environment variable to the absolute path of the index.js file. Workers are loaded with this variable present. When test files require the AVA module (assuming it's a version containing this commit of course), the index.js file redirects to the one used by the worker if necessary by comparing AVA_PATH. The redirect required most of index.js to be moved into a separate module (lib/main.js). Fixes #643.
I ran into this and it was because in the https://github.com/avajs/ava/blame/6d12abfdff4478a1b6f4e87237764b89eb05f18d/readme.md#L308 removing this line now removes the "Tests not found in [file path here]" error and ava correctly sees my tests and reports are accurate. |
Hello!,
I'm using the version 0.13.0 with the following environment: Node.js v5.6.0, darwin 15.3.0.
When I execute ava in the same folder than its contents the operation gets completed without problem. However, if I try to do the same specifying an absolute path outside the folder that holds the file I get:
Any idea?. Thanks!,
The text was updated successfully, but these errors were encountered: