Home > other >  Defining two o more functions in karate-config.js
Defining two o more functions in karate-config.js

Time:02-09

My karate-config.js is:

function config(){
    return karate.read('classpath:'   env_file());
}

function env_file(){
    var env_file = karate.env;
    if(!env_file){
        env_file = 'local.yml';
    }
    return 'env/'   env_file;
}

That was working fine until I upgraded my Java version to 17.

Now I'm getting the following exception:

org.graalvm.polyglot.PolyglotException: SyntaxError: Unnamed:5:0 Expected ) but found function

Is it possible now to define two functions in the same file?

Thanks in advance.

CodePudding user response:

No. It was never supposed to have been supported, I'm surprised it worked.

Also refer: https://github.com/karatelabs/karate#multiple-functions-in-one-file

  •  Tags:  
  • Related