k6 icon indicating copy to clipboard operation
k6 copied to clipboard

File resolution should print the filepath on error messages

Open ORESoftware opened this issue 1 year ago • 1 comments

Brief summary

I am sorry to report that this is a bug, and you probably won't believe me, I think k6 can locate the file, but some other immediate error happens:


#!/usr/bin/env bash

cd "$(dirname "$BASH_SOURCE")";

k6 run --config config.json test-js.js  ## this one fails

exit 0;
k6 run --config config.json test.js   ## this file works

the result:


          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

ERRO[0000] The moduleSpecifier "test-js.js" couldn't be found on local disk. Make sure that you've specified the right path to the file. If you're running k6 using the Docker image make sure you have mounted the local directory (-v /local/path/:/inside/docker/path) containing your script and modules so that they're accessible by k6 from inside of the container, see https://grafana.com/docs/k6/latest/using-k6/modules/#using-local-modules-with-docker. 

Please put the path(s) where it is searching for in the error message:

̶E̶R̶R̶O̶[̶0̶0̶0̶0̶]̶ ̶T̶h̶e̶ ̶m̶o̶d̶u̶l̶e̶S̶p̶e̶c̶i̶f̶i̶e̶r̶ ̶"̶t̶e̶s̶t̶-̶j̶s̶.̶j̶s̶"̶ ̶c̶o̶u̶l̶d̶n̶'̶t̶ ̶b̶e̶ ̶f̶o̶u̶n̶d̶ ̶o̶n̶ ̶l̶o̶c̶a̶l̶ ̶d̶i̶s̶k̶.̶

instead, please:

ERRO[0000] The moduleSpecifier "test-js.js" couldn't be found on local disk, here: <the path>

k6 version

k6 v0.49.0 (go1.21.6, darwin/amd64)

OS

k6 v0.49.0 (go1.21.6, darwin/amd64)

Docker version and image (if applicable)

n/a

Steps to reproduce the problem

the script above

Expected behaviour

expect to load file

Actual behaviour

must be something about -js.js idk

ORESoftware avatar Feb 27 '24 23:02 ORESoftware

ok update, the file name was wrong, all I can ask is to print the file directory that is being searched

Please put the path(s) where it is searching for in the error message:

̶E̶R̶R̶O̶[̶0̶0̶0̶0̶]̶ ̶T̶h̶e̶ ̶m̶o̶d̶u̶l̶e̶S̶p̶e̶c̶i̶f̶i̶e̶r̶ ̶"̶t̶e̶s̶t̶-̶j̶s̶.̶j̶s̶"̶ ̶c̶o̶u̶l̶d̶n̶'̶t̶ ̶b̶e̶ ̶f̶o̶u̶n̶d̶ ̶o̶n̶ ̶l̶o̶c̶a̶l̶ ̶d̶i̶s̶k̶.̶

instead, please:

ERRO[0000] The moduleSpecifier "test-js.js" couldn't be found on local disk, we searched here: <the path>

ORESoftware avatar Feb 27 '24 23:02 ORESoftware