Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Luc Didry
kresus
Commits
be8e2c95
Commit
be8e2c95
authored
Apr 22, 2019
by
Benjamin Bouvier
Browse files
Make assertions fatal errors in testing;
parent
715f0d94
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/helpers.js
View file @
be8e2c95
...
...
@@ -49,6 +49,10 @@ export function debug(...args) {
export
function
assert
(
x
,
wat
)
{
if
(
!
x
)
{
let
text
=
`Assertion error:
${
wat
?
wat
:
''
}
\n
${
new
Error
().
stack
}
`
;
if
(
process
.
env
.
NODE_ENV
===
'
test
'
)
{
// During testing, errors should be fatal.
throw
new
Error
(
text
);
}
if
(
ASSERTS
)
{
window
.
alert
(
text
);
console
.
error
(
text
);
...
...
Write
Preview
Supports
Markdown
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