Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
11178b2c
Commit
11178b2c
authored
Apr 22, 2020
by
LianaHus
Committed by
Aniket
Apr 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle errors
parent
9ad00485
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
test-tab.js
src/app/tabs/test-tab.js
+8
-8
No files found.
src/app/tabs/test-tab.js
View file @
11178b2c
...
@@ -32,6 +32,7 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -32,6 +32,7 @@ module.exports = class TestTab extends ViewPlugin {
this
.
hasBeenStopped
=
false
this
.
hasBeenStopped
=
false
this
.
runningTestsNumber
=
0
this
.
runningTestsNumber
=
0
this
.
readyTestsNumber
=
0
this
.
readyTestsNumber
=
0
this
.
areTestsRunning
=
false
this
.
baseurl
=
'https://solc-bin.ethereum.org/bin'
this
.
baseurl
=
'https://solc-bin.ethereum.org/bin'
appManager
.
event
.
on
(
'activate'
,
(
name
)
=>
{
appManager
.
event
.
on
(
'activate'
,
(
name
)
=>
{
if
(
name
===
'solidity'
)
this
.
updateRunAction
(
fileManager
.
currentFile
())
if
(
name
===
'solidity'
)
this
.
updateRunAction
(
fileManager
.
currentFile
())
...
@@ -63,7 +64,7 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -63,7 +64,7 @@ module.exports = class TestTab extends ViewPlugin {
this
.
fileManager
.
events
.
on
(
'currentFileChanged'
,
(
file
,
provider
)
=>
{
this
.
fileManager
.
events
.
on
(
'currentFileChanged'
,
(
file
,
provider
)
=>
{
this
.
updateGenerateFileAction
(
file
)
this
.
updateGenerateFileAction
(
file
)
this
.
updateRunAction
(
file
)
if
(
!
this
.
areTestsRunning
)
this
.
updateRunAction
(
file
)
this
.
testTabLogic
.
getTests
((
error
,
tests
)
=>
{
this
.
testTabLogic
.
getTests
((
error
,
tests
)
=>
{
if
(
error
)
return
tooltip
(
error
)
if
(
error
)
return
tooltip
(
error
)
this
.
data
.
allTests
=
tests
this
.
data
.
allTests
=
tests
...
@@ -139,22 +140,18 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -139,22 +140,18 @@ module.exports = class TestTab extends ViewPlugin {
updateFinalResult
(
_errors
,
result
,
filename
)
{
updateFinalResult
(
_errors
,
result
,
filename
)
{
this
.
testsSummary
.
hidden
=
false
this
.
testsSummary
.
hidden
=
false
++
this
.
readyTestsNumber
if
(
_errors
&&
_errors
.
errors
)
{
if
(
_errors
&&
_errors
.
errors
)
{
_errors
.
errors
.
forEach
((
err
)
=>
this
.
renderer
.
error
(
err
.
formattedMessage
||
err
.
message
,
this
.
testsSummary
,
{
type
:
err
.
severity
}))
_errors
.
errors
.
forEach
((
err
)
=>
this
.
renderer
.
error
(
err
.
formattedMessage
||
err
.
message
,
this
.
testsSummary
,
{
type
:
err
.
severity
}))
return
}
else
if
(
_errors
&&
Array
.
isArray
(
_errors
)
&&
(
_errors
[
0
].
message
||
_errors
[
0
].
formattedMessage
))
{
}
else
if
(
_errors
&&
Array
.
isArray
(
_errors
)
&&
(
_errors
[
0
].
message
||
_errors
[
0
].
formattedMessage
))
{
_errors
.
forEach
((
err
)
=>
this
.
renderer
.
error
(
err
.
formattedMessage
||
err
.
message
,
this
.
testsSummary
,
{
type
:
err
.
severity
}))
_errors
.
forEach
((
err
)
=>
this
.
renderer
.
error
(
err
.
formattedMessage
||
err
.
message
,
this
.
testsSummary
,
{
type
:
err
.
severity
}))
return
}
else
if
(
_errors
&&
!
_errors
.
errors
&&
!
Array
.
isArray
(
_errors
))
{
}
else
if
(
_errors
&&
!
_errors
.
errors
&&
!
Array
.
isArray
(
_errors
))
{
// To track error like this: https://github.com/ethereum/remix/pull/1438
// To track error like this: https://github.com/ethereum/remix/pull/1438
this
.
renderer
.
error
(
_errors
.
formattedMessage
||
_errors
.
message
,
this
.
testsSummary
,
{
type
:
'error'
})
this
.
renderer
.
error
(
_errors
.
formattedMessage
||
_errors
.
message
,
this
.
testsSummary
,
{
type
:
'error'
})
return
}
}
this
.
testsSummary
.
appendChild
(
yo
`<div class=
${
css
.
summaryTitle
}
>
${
filename
}
</div>`
)
this
.
testsSummary
.
appendChild
(
yo
`<div class=
${
css
.
summaryTitle
}
>
${
filename
}
</div>`
)
yo
.
update
(
this
.
resultStatistics
,
this
.
createResultLabel
())
if
(
result
)
{
if
(
result
)
{
++
this
.
readyTestsNumber
yo
.
update
(
this
.
resultStatistics
,
this
.
createResultLabel
())
if
(
result
.
totalPassing
>
0
)
{
if
(
result
.
totalPassing
>
0
)
{
this
.
testsSummary
.
appendChild
(
yo
`<div class="text-success">
${
result
.
totalPassing
}
passing (
${
result
.
totalTime
}
s)</div>`
)
this
.
testsSummary
.
appendChild
(
yo
`<div class="text-success">
${
result
.
totalPassing
}
passing (
${
result
.
totalTime
}
s)</div>`
)
this
.
testsSummary
.
appendChild
(
yo
`<br>`
)
this
.
testsSummary
.
appendChild
(
yo
`<br>`
)
...
@@ -170,6 +167,7 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -170,6 +167,7 @@ module.exports = class TestTab extends ViewPlugin {
})
})
}
}
if
(
this
.
hasBeenStopped
&&
(
this
.
readyTestsNumber
!==
this
.
runningTestsNumber
))
{
if
(
this
.
hasBeenStopped
&&
(
this
.
readyTestsNumber
!==
this
.
runningTestsNumber
))
{
// if all tests has been through before stopping no need to print this.
this
.
testsExecutionStopped
.
hidden
=
false
this
.
testsExecutionStopped
.
hidden
=
false
}
}
if
(
this
.
hasBeenStopped
||
this
.
readyTestsNumber
===
this
.
runningTestsNumber
)
{
if
(
this
.
hasBeenStopped
||
this
.
readyTestsNumber
===
this
.
runningTestsNumber
)
{
...
@@ -182,6 +180,7 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -182,6 +180,7 @@ module.exports = class TestTab extends ViewPlugin {
const
runBtn
=
document
.
getElementById
(
'runTestsTabRunAction'
)
const
runBtn
=
document
.
getElementById
(
'runTestsTabRunAction'
)
runBtn
.
removeAttribute
(
'disabled'
)
runBtn
.
removeAttribute
(
'disabled'
)
}
}
this
.
areTestsRunning
=
false
}
}
}
}
...
@@ -249,6 +248,7 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -249,6 +248,7 @@ module.exports = class TestTab extends ViewPlugin {
}
}
runTests
()
{
runTests
()
{
this
.
areTestsRunning
=
true
this
.
hasBeenStopped
=
false
this
.
hasBeenStopped
=
false
this
.
readyTestsNumber
=
0
this
.
readyTestsNumber
=
0
this
.
runningTestsNumber
=
this
.
data
.
selectedTests
.
length
this
.
runningTestsNumber
=
this
.
data
.
selectedTests
.
length
...
@@ -275,7 +275,7 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -275,7 +275,7 @@ module.exports = class TestTab extends ViewPlugin {
stopTests
()
{
stopTests
()
{
this
.
hasBeenStopped
=
true
this
.
hasBeenStopped
=
true
const
stopBtnLabel
=
document
.
getElementById
(
'runTestsTabStopActionLabel'
)
const
stopBtnLabel
=
document
.
getElementById
(
'runTestsTabStopActionLabel'
)
stopBtnLabel
.
innerText
=
'Stopping
...
'
stopBtnLabel
.
innerText
=
'Stopping'
const
stopBtn
=
document
.
getElementById
(
'runTestsTabStopAction'
)
const
stopBtn
=
document
.
getElementById
(
'runTestsTabStopAction'
)
stopBtn
.
setAttribute
(
'disabled'
,
'disabled'
)
stopBtn
.
setAttribute
(
'disabled'
,
'disabled'
)
const
runBtn
=
document
.
getElementById
(
'runTestsTabRunAction'
)
const
runBtn
=
document
.
getElementById
(
'runTestsTabRunAction'
)
...
...
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