From d8edaf2851451d109769c29785df804e72bf96bf Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Mon, 9 Jul 2018 13:20:18 +0200 Subject: [PATCH] Fail Karma tests that take longer than a second --- spec/javascripts/test_bundle.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js index bc00fdfd73c..59e472789e2 100644 --- a/spec/javascripts/test_bundle.js +++ b/spec/javascripts/test_bundle.js @@ -91,6 +91,19 @@ beforeEach(() => { Vue.http.interceptors = builtinVueHttpInterceptors.slice(); }); +let longRunningTestTimeoutHandle; + +beforeEach((done) => { + longRunningTestTimeoutHandle = setTimeout(() => { + done.fail('Test is running too long!'); + }, 1000); + done(); +}); + +afterEach(() => { + clearTimeout(longRunningTestTimeoutHandle); +}); + const axiosDefaultAdapter = getDefaultAdapter(); // render all of our tests