Hi all, does anyone know if there is a way to conf...
# javascript
k
Hi all, does anyone know if there is a way to configure the default timeout of the mocha runner used for js/nodejs target ? We are hitting the default timeout of 2s on one of our testcases
👍 1
i
Hi, if you use nodejs You can set it in build script
Copy code
nodejs {
   testTask {
      useMocha {
         timeout = "10s"
      }
   }
}
👍 1
k
Thanks!
y
FWIW, if someone comes across this thread and wants to do the same for browser tests (that use
karma
) , here is how I did it: • Create
karma.config.d
in the project directory • Atleast kotlin-gradle
1.3.71
checks this directory for an
js
files and blindly appends them to the generated
karma.conf.js
[1] • Create a file
karma.config.d/mocha-timeout-override.s
with following content [2]
Copy code
config.set({
  "client": {
    "mocha": {
      "timeout": 5000
    },
  },
});
[1] https://github.com/JetBrains/kotlin/blob/7fe66d3456a2e51e5bf228497e81b28a6367766c/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/testing/karma/KotlinKarma.kt#L44 [2] http://blog.jonathanargentiero.com/overriding-karma-mocha-default-timeout-2000ms/