Home > Software engineering >  Karate - karate.configure('headers', { Accept: 'application/json' }); is not rec
Karate - karate.configure('headers', { Accept: 'application/json' }); is not rec

Time:12-04

I have setup a new karate project and everything working fine but when I try to use "karate.configure()" in "karate-config.js" file it does not recognize and when I hover over it, I get this message "missing import statements, insert const karate = require(./Chart.min)"

This is how my "karate-config.js" file looks like: "```

function fn() {

karate.configure("headers", {'Content-Type':'application/x-www-form-urlencoded'})
karate.configure('connectTimeout', 6000000);
karate.configure('readTimeout', 6000000);
var config = {
    baseUrl: 'https://someurl',
    iprHost: 'https://url',


};

return config;

}



And the dependencies I am using are :

"```
 <dependency>
            <groupId>com.intuit.karate</groupId>
            <artifactId>karate-apache</artifactId>
            <version>0.9.6</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.intuit.karate/karate-junit4 -->
        <dependency>
            <groupId>com.intuit.karate</groupId>
            <artifactId>karate-junit4</artifactId>
            <version>1.1.0</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/net.masterthought/cucumber-reporting -->
        <dependency>
            <groupId>net.masterthought</groupId>
            <artifactId>cucumber-reporting</artifactId>
            <version>5.6.1</version>
        </dependency>

```"

CodePudding user response:

Your dependencies are wrong. Also note that we don't support old versions any more. I suggest you use the quick-start as it will set up all you need: https://github.com/karatelabs/karate#quickstart

You can ignore the message about import statements, Karate's version of JS does not need any.

If you are still stuck follow this process: https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue

  • Related