-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
k6 path resolution doesn't work from CWD when running from stdin #1462
Comments
Neither work for me! Had to specify full paths in my test script. |
I had the same issue but a little bit different, I had forgotten lastfix ".js", I mean I imported |
@ecmyilmz this seems like #475 and as written there it's very unlikely that k6 will start adding |
I have the same issue on mac os Big Sur 11.5.2 |
Thank you! I had to change import { config } from '../environment'; to import { config } from '../environment.js'; |
Usually the working dir for a given script is set based on it's path. For test from stdin that path is file:///- so it is basically the root folder. With this change this changes to the directory k6 was ran from. This means when you do `cat script.js | k6 run -` the working dir will be the same as if you did `k6 run script.js`. But there is still no way to fix `cat path/to/somewhere/script.js | k6 run -` as k6 can't know where it got it's stdin from. fixes #1462
Usually the working dir for a given script is set based on it's path. For test from stdin that path is file:///- so it is basically the root folder. With this change this changes to the directory k6 was ran from. This means when you do `cat script.js | k6 run -` the working dir will be the same as if you did `k6 run script.js`. But there is still no way to fix `cat path/to/somewhere/script.js | k6 run -` as k6 can't know where it got it's stdin from. fixes #1462
Environment
Expected Behavior
If I have the following as
test.js
:and if I have this as
script.js
:And both of these files are in the same folder, I should be able to execute them both by running
k6 run ./script.js
andk6 run - <./script.js
, and get123
printed either way.Actual Behavior
Instead, only the first command works. The second gives the following error:
For some reason, it's looking at the import file in the root folder.
The text was updated successfully, but these errors were encountered: