-
Notifications
You must be signed in to change notification settings - Fork 6
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
Is there a way to run tests from project directory? #32
Comments
Upd: I ended up in using pkg-dir module, it works good. |
Yea, I agree that tweaking this makes sense. I will probably have some "projectRoot" setting, defaulting to your workspace folder, that controls the cwd among other things (things that we naively root at the workspace folder today) |
That would've been great! |
Great extension, thank you for your work! Running in to this same issue - tests are all written assuming execution from projectRoot and fail when using test runner. Current workaround is:
{
"nodejs-testing.pretest": [
"./test-prep.sh"
]
}
cd .. |
Hello! Thanks for your extension!
I have a problem. I have test data in '{project_dir}/testdata' folder, and I want them to load it from filesystem in tests. But it seems that Test Explorer runs tests with cwd set to test file' directory.
For example, if I try to do this in file 'tests/foo/bar.test.js':
I'm getting cryptic window with message: 'The editor could not be opened because the file was not found.' Command 'node --test' from terminal, if I run it from project directory, works great though.
However, if I change filepath to relative:
it works smoothly.
I made a small investigation: command process.cwd(), executed in a debug console, gets me directory of a test file. In comparison, same command when I run tests with jest, results in the project directory.
So, is it possible to fix it so that tests always run from project directory?
The text was updated successfully, but these errors were encountered: