[karate][standalone v0.9.1] Error : could not find or read file: file:xxx/yyy/zzz/./karate-config.js

Viewed 3728

I am only using the latest standalone karate jar to test my API on a docker image configured with JRE and I don't have any Java code.

This is what i have currently with the new version :

09:30:37.333 [main] INFO com.intuit.karate.netty.Main - Karate version: 0.9.1 09:30:37.489 [main] INFO com.intuit.karate.Runner - Karate version: 0.9.1 09:30:38.067 [ForkJoinPool-1-worker-1] WARN com.intuit.karate - skipping bootstrap configuration: could not find or read file: file:xxx/yyy/zzz/./karate-config.js

Here we can see it didn't find my karate-config.js file

This is what i have with the v0.9.0 :

09:48:35.829 [main] INFO com.intuit.karate.netty.Main - Karate version: 0.9.0 09:48:35.971 [main] INFO com.intuit.karate.Runner - Karate version: 0.9.0 09:48:36.559 [ForkJoinPool-1-worker-1] INFO com.intuit.karate - karate.env selected environment was: preprod

Here we can see it found my karate-config.js file

Did something change on 0.9.1 ?

Thank you.

2 Answers

Yes something changed :( - we've been trying to fix this file resolution problem for a while. It would be great if you help us reproduce this. Since you don't use Java, can you create a zip file of the directory structure that can replicate this problem.

As a workaround, please try setting the location to the config file as per the docs:

-Dkarate.config.dir=xxx/yyy/zzz

EDIT - this is fixed and you need to re-download the binary (same version) from here: https://github.com/intuit/karate/releases/tag/v0.9.1

Okay, it works with

-Dkarate.config.dir=xxx/yyy/zzz

But only on this case :

-Dkarate.config.dir="./"

I have reproduced the error on a simplified environment, you can download this file : Karate-Test Zip File

You just have then to execute the different .sh and see what is happening.

On the file karate-0.9.1/karate-0.9.1.sh , you have to read the comment, it works on a specific case, and it doesn't on another.

EDIT : Another thing,

even on the 0.9.0 version case, it doesn't work when i'm not on the same directory than the script during the execution of the script

for instance, if i'm not on the same directory, this command is not working :

./karate-0.9.0/karate-0.9.0.sh

13:01:25.764 [main] INFO com.intuit.karate.netty.Main - Karate version: 0.9.0 13:01:25.830 [main] INFO com.intuit.karate.Runner - Karate version: 0.9.0 13:01:26.402 [ForkJoinPool-1-worker-1] WARN com.intuit.karate - skipping bootstrap configuration: could not find or read file: classpath:karate-config.js

while this one is if i'm on the same directory :

./karate-0.9.0.sh 13:03:54.831 [main] INFO com.intuit.karate.netty.Main - Karate version: 0.9.0 13:03:54.905 [main] INFO com.intuit.karate.Runner - Karate version: 0.9.0 13:03:55.421 [ForkJoinPool-1-worker-1] INFO com.intuit.karate - baseUrl selected was: https://petstore.swagger.io

Related