yurbles
yurbles

Reputation: 360

Use karate-config.js with standalone jar?

I have a karate-config.js file:

function init() {
  karate.log("Env set to ", karate.env);
  karate.log("baseURL ", karate.properties["baseURL"]);
  karate.log("OriginURl", karate.properties["OriginURL"]);

  return {
    foo: "bar"
  };
}

and I'm running using the standalone karate.jar:

amzuko@DESKTOP-V0PECAR:/mnt/c/Joincad/komodo$ java -jar  bin/karate.jar path/to/my/feature
16:42:53.943 [main] INFO  com.intuit.karate.netty.Main - Karate version: 0.9.0
16:42:54.054 [main] INFO  com.intuit.karate.Runner - Karate version: 0.9.0
16:42:54.849 [ForkJoinPool-1-worker-1] WARN  com.intuit.karate - not a js function or feature file: read('file:./karate-config.js') - [type: NULL, value: null]
...

I see the same "not a js function or feature file: read('file:./karate-config.js') - [type: NULL, value: null]" error message whether I set the karate.config path explicitly or not. If I set the karate.config.path value to a directory that does not contain a karate-config.js file,

I'm running this primarily on the windows subsystem for linux. I get identical results (modulo needing to swap back and forward slashes in the paths) when I run using git-bash and powershell in the windows environment directly.

My project structure is, where the working directory is '/':

/services/tests/*.feature  <<-- features here
/bin/karate.jar
/karate-config.js

I'm using karate to test an API implemented in golang. I've tried with 0.8.1 and 0.9.0.

Any ideas on what I'm doing wrong?

Upvotes: 1

Views: 1216

Answers (1)

yurbles
yurbles

Reputation: 360

This turned out to be related in some way to the fix for https://github.com/intuit/karate/issues/624, and as of 1/7/2019, using a .jar built from the develop branch of karate resolved my problems.

Upvotes: 1

Related Questions