Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2e5163d8
Commit
2e5163d8
authored
Mar 11, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
cc833344
1e035484
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
16 deletions
+26
-16
spec/frontend/helpers/timeout.js
spec/frontend/helpers/timeout.js
+24
-0
spec/frontend/test_setup.js
spec/frontend/test_setup.js
+2
-16
No files found.
spec/frontend/helpers/timeout.js
0 → 100644
View file @
2e5163d8
let
testTimeoutInMs
;
export
const
setTestTimeout
=
newTimeoutInMs
=>
{
testTimeoutInMs
=
newTimeoutInMs
;
jest
.
setTimeout
(
newTimeoutInMs
);
};
export
const
initializeTestTimeout
=
defaultTimeoutInMs
=>
{
setTestTimeout
(
defaultTimeoutInMs
);
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)!`
);
}
});
};
spec/frontend/test_setup.js
View file @
2e5163d8
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
initializeTestTimeout
}
from
'
./helpers/timeout
'
;
const
testTimeoutInMs
=
300
;
initializeTestTimeout
(
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)!`
);
}
});
// fail tests for unmocked requests
// fail tests for unmocked requests
beforeEach
(
done
=>
{
beforeEach
(
done
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment