简体   繁体   中英

Defining two o more functions in karate-config.js

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM