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
51f73b86
Commit
51f73b86
authored
Nov 02, 2017
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Vue warnhandler
parent
0713188b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
18 deletions
+22
-18
spec/javascripts/test_bundle.js
spec/javascripts/test_bundle.js
+22
-18
No files found.
spec/javascripts/test_bundle.js
View file @
51f73b86
...
...
@@ -11,6 +11,12 @@ const isHeadlessChrome = /\bHeadlessChrome\//.test(navigator.userAgent);
Vue
.
config
.
devtools
=
!
isHeadlessChrome
;
Vue
.
config
.
productionTip
=
false
;
let
hasVueWarnings
=
false
;
Vue
.
config
.
warnHandler
=
(
msg
,
vm
,
trace
)
=>
{
hasVueWarnings
=
true
;
fail
(
`
${
msg
}${
trace
}
`
);
};
Vue
.
use
(
VueResource
);
// enable test fixtures
...
...
@@ -34,11 +40,6 @@ window.addEventListener('unhandledrejection', (event) => {
console
.
error
(
event
.
reason
.
stack
||
event
.
reason
);
});
const
checkUnhandledPromiseRejections
=
(
done
)
=>
{
expect
(
hasUnhandledPromiseRejections
).
toBe
(
false
);
done
();
};
// HACK: Chrome 59 disconnects if there are too many synchronous tests in a row
// because it appears to lock up the thread that communicates to Karma's socket
// This async beforeEach gets called on every spec and releases the JS thread long
...
...
@@ -47,17 +48,6 @@ const checkUnhandledPromiseRejections = (done) => {
// to run our unit tests.
beforeEach
(
done
=>
done
());
beforeAll
(()
=>
{
const
origError
=
console
.
error
;
spyOn
(
console
,
'
error
'
).
and
.
callFake
((
message
)
=>
{
if
(
/^
\[
Vue warn
\]
/
.
test
(
message
))
{
fail
(
message
);
}
else
{
origError
(
message
);
}
});
});
const
builtinVueHttpInterceptors
=
Vue
.
http
.
interceptors
.
slice
();
beforeEach
(()
=>
{
...
...
@@ -80,8 +70,22 @@ testsContext.keys().forEach(function (path) {
}
});
it
(
'
has no unhandled Promise rejections
'
,
(
done
)
=>
{
setTimeout
(
checkUnhandledPromiseRejections
(
done
),
1000
);
describe
(
'
test errors
'
,
()
=>
{
beforeAll
((
done
)
=>
{
if
(
hasUnhandledPromiseRejections
||
hasVueWarnings
)
{
setTimeout
(
done
,
1000
);
}
else
{
done
();
}
});
it
(
'
has no unhandled Promise rejections
'
,
()
=>
{
expect
(
hasUnhandledPromiseRejections
).
toBe
(
false
);
});
it
(
'
has no Vue warnings
'
,
()
=>
{
expect
(
hasVueWarnings
).
toBe
(
false
);
});
});
// if we're generating coverage reports, make sure to include all files so
...
...
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