1// Set a fairly long test timeout because some tests in collection
2// (specifically insertManyRemoveMany) occasionally take 20+ seconds to complete.
3var testTimeoutInMs = 1000 * 30
4// disconnect timeout should be longer than test timeout so we don't disconnect before the timeout
5// is reported.
6var browserDisconnectTimeoutInMs = testTimeoutInMs + 5000
7config.set({
8  // https://karma-runner.github.io/6.4/config/configuration-file.html
9    browserDisconnectTimeout: browserDisconnectTimeoutInMs,
10    processKillTimeout: testTimeoutInMs,
11    concurrency: 3,
12    client: {
13      mocha: {
14        timeout: testTimeoutInMs
15      }
16    }
17});
18
19// Add 10 second delay exit to ensure log flushing. This is needed for Kotlin to avoid flakiness when
20// marking a test as complete. See (b/382336155)
21// Remove when https://youtrack.jetbrains.com/issue/KT-73911/ is resolved.
22(function() {
23  const originalExit = process.exit;
24  process.exit = function(code) {
25    console.log('Delaying exit for logs...');
26    setTimeout(() => {
27      originalExit(code);
28    }, 10000);
29  };
30})();
31