Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test_setup.js « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7ad2e97e7e6f7d31771c05992278d71052f9979b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const testTimeoutInMs = 300;
jest.setTimeout(testTimeoutInMs);

let testStartTime;

// https://github.com/facebook/jest/issues/6947
beforeEach(() => {
  testStartTime = Date.now();
});

afterEach(() => {
  const elapsedTimeInMs = Date.now() - testStartTime;
  if (elapsedTimeInMs > testTimeoutInMs) {
    throw new Error(`Test took too long (${elapsedTimeInMs}ms > ${testTimeoutInMs}ms)!`);
  }
});