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
0e561c94
Commit
0e561c94
authored
Feb 09, 2019
by
Omkara
Committed by
0mkar
Mar 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update contract to sol v0.5.0, add more typings, make runTestFiles work
parent
368f9113
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
60 deletions
+73
-60
simple_storage.sol
remix-tests/examples/simple_storage.sol
+0
-1
package.json
remix-tests/package.json
+2
-0
run.ts
remix-tests/src/run.ts
+5
-7
runTestFiles.ts
remix-tests/src/runTestFiles.ts
+43
-33
runTestSources.ts
remix-tests/src/runTestSources.ts
+2
-3
testRunner.ts
remix-tests/src/testRunner.ts
+21
-16
No files found.
remix-tests/examples/simple_storage.sol
View file @
0e561c94
...
@@ -13,5 +13,4 @@ contract SimpleStorage {
...
@@ -13,5 +13,4 @@ contract SimpleStorage {
function get() public view returns (uint retVal) {
function get() public view returns (uint retVal) {
return storedData;
return storedData;
}
}
}
}
remix-tests/package.json
View file @
0e561c94
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
"homepage"
:
"https://github.com/ethereum/remix-tests#readme"
,
"homepage"
:
"https://github.com/ethereum/remix-tests#readme"
,
"dependencies"
:
{
"dependencies"
:
{
"@types/async"
:
"^2.4.0"
,
"@types/async"
:
"^2.4.0"
,
"@types/colors"
:
"^1.2.1"
,
"@types/web3"
:
"^1.0.18"
,
"@types/web3"
:
"^1.0.18"
,
"async"
:
"^2.6.0"
,
"async"
:
"^2.6.0"
,
"change-case"
:
"^3.0.1"
,
"change-case"
:
"^3.0.1"
,
...
@@ -54,6 +55,7 @@
...
@@ -54,6 +55,7 @@
"yo-yoify"
:
"latest"
"yo-yoify"
:
"latest"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"@types/commander"
:
"^2.12.2"
,
"@types/mocha"
:
"^5.2.5"
,
"@types/mocha"
:
"^5.2.5"
,
"@types/node"
:
"^10.12.21"
,
"@types/node"
:
"^10.12.21"
,
"babel-preset-es2017"
:
"^6.24.1"
,
"babel-preset-es2017"
:
"^6.24.1"
,
...
...
remix-tests/src/run.ts
View file @
0e561c94
#!/usr/bin/env ts-node
import
commander
from
'commander'
const
commander
=
require
(
'commander'
)
import
Web3
from
'web3'
import
Web3
from
'web3'
import
{
runTestFiles
}
from
'./runTestFiles'
import
{
runTestFiles
}
from
'./runTestFiles'
import
fs
from
'./fileSystem'
import
fs
from
'./fileSystem'
const
Provider
=
require
(
'remix-simulator'
).
Provider
const
Provider
=
require
(
'remix-simulator'
).
Provider
import
Log
=
require
(
'./logger'
)
import
Log
from
'./logger'
const
logger
=
new
Log
()
const
logger
=
new
Log
()
const
log
=
logger
.
logger
const
log
=
logger
.
logger
require
(
'colors'
)
import
colors
from
'colors'
// parse verbosity
// parse verbosity
function
mapVerbosity
(
v
)
{
function
mapVerbosity
(
v
:
number
)
{
const
levels
=
{
const
levels
=
{
0
:
'error'
,
0
:
'error'
,
1
:
'warn'
,
1
:
'warn'
,
...
@@ -39,7 +37,7 @@ commander
...
@@ -39,7 +37,7 @@ commander
.
option
(
'-v, --verbose <level>'
,
'run with verbosity'
,
mapVerbosity
)
.
option
(
'-v, --verbose <level>'
,
'run with verbosity'
,
mapVerbosity
)
.
action
(
function
(
filename
)
{
.
action
(
function
(
filename
)
{
// Console message
// Console message
console
.
log
(
(
'
\
n
\
t👁 :: Running remix-tests - Unit testing for solidity :: 👁
\
t
\
n'
),
'color: white'
)
console
.
log
(
colors
.
white
(
'
\
n
\
t👁
\
t:: Running remix-tests - Unit testing for solidity ::
\
t👁
\
n'
)
)
// set logger verbosity
// set logger verbosity
if
(
commander
.
verbose
)
{
if
(
commander
.
verbose
)
{
logger
.
setVerbosity
(
commander
.
verbose
)
logger
.
setVerbosity
(
commander
.
verbose
)
...
...
remix-tests/src/runTestFiles.ts
View file @
0e561c94
import
async
=
require
(
'async'
)
import
async
from
'async'
import
path
=
require
(
'path'
)
import
fs
from
'./fileSystem'
import
fs
from
'./fileSystem'
import
{
runTest
}
from
'./testRunner'
import
{
runTest
,
TestResultInterface
,
ResultsInterface
}
from
'./testRunner'
require
(
'colors'
)
import
colors
from
'colors'
import
Web3
from
'web3'
import
Compiler
=
require
(
'./compiler'
)
import
{
compileFileOrFiles
}
from
'./compiler'
import
Deployer
=
require
(
'./deployer'
)
import
{
deployAll
}
from
'./deployer'
export
function
runTestFiles
(
filepath
,
isDirectory
,
web3
,
opts
=
{}
)
{
export
function
runTestFiles
(
filepath
:
string
,
isDirectory
:
boolean
,
web3
:
Web3
,
opts
?:
object
)
{
opts
=
opts
||
{}
opts
=
opts
||
{}
const
{
Signale
}
=
require
(
'signale'
)
const
{
Signale
}
=
require
(
'signale'
)
// signale configuration
// signale configuration
...
@@ -33,38 +33,42 @@ export function runTestFiles(filepath, isDirectory, web3, opts = {}) {
...
@@ -33,38 +33,42 @@ export function runTestFiles(filepath, isDirectory, web3, opts = {}) {
const
signale
=
new
Signale
(
options
)
const
signale
=
new
Signale
(
options
)
let
accounts
=
opts
[
'accounts'
]
||
null
let
accounts
=
opts
[
'accounts'
]
||
null
async
.
waterfall
([
async
.
waterfall
([
function
getAccountList
(
next
)
{
function
getAccountList
(
next
:
Function
)
{
if
(
accounts
)
return
next
(
null
)
if
(
accounts
)
return
next
(
null
)
web3
.
eth
.
getAccounts
((
_err
,
_accounts
)
=>
{
web3
.
eth
.
getAccounts
((
_err
:
Error
|
null
|
undefined
,
_accounts
)
=>
{
accounts
=
_accounts
accounts
=
_accounts
next
(
null
)
next
(
null
)
})
})
},
},
function
compile
(
next
)
{
function
compile
(
next
:
Function
)
{
Compiler
.
compileFileOrFiles
(
filepath
,
isDirectory
,
{
accounts
},
next
)
compileFileOrFiles
(
filepath
,
isDirectory
,
{
accounts
},
next
)
},
},
function
deployAllContracts
(
compilationResult
,
next
)
{
function
deployAllContracts
(
compilationResult
,
next
:
Function
)
{
Deployer
.
deployAll
(
compilationResult
,
web3
,
function
(
err
,
contracts
)
{
deployAll
(
compilationResult
,
web3
,
(
err
,
contracts
)
=>
{
if
(
err
)
{
if
(
err
)
{
next
(
err
)
next
(
err
)
}
}
next
(
null
,
compilationResult
,
contracts
)
next
(
null
,
compilationResult
,
contracts
)
})
})
},
},
function
determineTestContractsToRun
(
compilationResult
,
contracts
,
next
)
{
function
determineTestContractsToRun
(
compilationResult
,
contracts
,
next
:
Function
)
{
let
contractsToTest
:
any
[]
=
[]
let
contractsToTest
:
any
[]
=
[]
let
contractsToTestDetails
:
any
[]
=
[]
let
contractsToTestDetails
:
any
[]
=
[]
const
gatherContractsFrom
=
(
filename
)
=>
{
const
gatherContractsFrom
=
function
(
filename
:
string
)
{
if
(
filename
.
indexOf
(
'_test.sol'
)
<
0
)
{
if
(
filename
.
indexOf
(
'_test.sol'
)
<
0
)
{
return
return
}
}
Object
.
keys
(
compilationResult
[
path
.
basename
(
filename
)]).
forEach
(
contractName
=>
{
try
{
contractsToTest
.
push
(
contractName
)
Object
.
keys
(
compilationResult
[
filename
]).
forEach
(
contractName
=>
{
contractsToTestDetails
.
push
(
compilationResult
[
path
.
basename
(
filename
)][
contractName
])
contractsToTest
.
push
(
contractName
)
})
contractsToTestDetails
.
push
(
compilationResult
[
filename
][
contractName
])
})
}
catch
(
e
)
{
console
.
error
(
e
)
}
}
}
if
(
isDirectory
)
{
if
(
isDirectory
)
{
fs
.
walkSync
(
filepath
,
foundpath
=>
{
fs
.
walkSync
(
filepath
,
(
foundpath
:
string
)
=>
{
gatherContractsFrom
(
foundpath
)
gatherContractsFrom
(
foundpath
)
})
})
}
else
{
}
else
{
...
@@ -72,13 +76,14 @@ export function runTestFiles(filepath, isDirectory, web3, opts = {}) {
...
@@ -72,13 +76,14 @@ export function runTestFiles(filepath, isDirectory, web3, opts = {}) {
}
}
next
(
null
,
contractsToTest
,
contractsToTestDetails
,
contracts
)
next
(
null
,
contractsToTest
,
contractsToTestDetails
,
contracts
)
},
},
function
runTests
(
contractsToTest
,
contractsToTestDetails
,
contracts
,
next
)
{
function
runTests
(
contractsToTest
,
contractsToTestDetails
,
contracts
,
next
:
Function
)
{
let
totalPassing
=
0
let
totalPassing
:
number
=
0
let
totalFailing
=
0
let
totalFailing
:
number
=
0
let
totalTime
=
0
let
totalTime
:
number
=
0
let
errors
:
any
[]
=
[]
let
errors
:
any
[]
=
[]
var
testCallback
=
function
(
result
)
{
var
_testCallback
=
function
(
err
:
Error
|
null
|
undefined
,
result
:
TestResultInterface
)
{
if
(
err
)
throw
err
;
if
(
result
.
type
===
'contract'
)
{
if
(
result
.
type
===
'contract'
)
{
signale
.
name
(
result
.
value
.
white
)
signale
.
name
(
result
.
value
.
white
)
}
else
if
(
result
.
type
===
'testPass'
)
{
}
else
if
(
result
.
type
===
'testPass'
)
{
...
@@ -88,20 +93,25 @@ export function runTestFiles(filepath, isDirectory, web3, opts = {}) {
...
@@ -88,20 +93,25 @@ export function runTestFiles(filepath, isDirectory, web3, opts = {}) {
errors
.
push
(
result
)
errors
.
push
(
result
)
}
}
}
}
var
resultsCallback
=
function
(
_err
,
result
,
cb
)
{
var
_resultsCallback
=
(
_err
:
Error
|
null
|
undefined
,
result
:
ResultsInterface
,
cb
)
=>
{
totalPassing
+=
result
.
passingNum
totalPassing
+=
result
.
passingNum
totalFailing
+=
result
.
failureNum
totalFailing
+=
result
.
failureNum
totalTime
+=
result
.
timePassed
totalTime
+=
result
.
timePassed
cb
()
cb
()
}
}
async
.
eachOfLimit
(
contractsToTest
,
1
,
(
contractName
,
index
,
cb
)
=>
{
async
.
eachOfLimit
(
contractsToTest
,
1
,
(
contractName
:
string
,
index
,
cb
)
=>
{
runTest
(
contractName
,
contracts
(
contractName
),
contractsToTestDetails
[
index
],
{
accounts
},
testCallback
,
(
err
,
result
)
=>
{
try
{
runTest
(
contractName
,
contracts
[
contractName
],
contractsToTestDetails
[
index
],
{
accounts
},
_testCallback
,
(
err
,
result
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
err
)
return
cb
(
err
)
return
cb
(
err
)
}
}
resultsCallback
(
null
,
result
,
cb
)
_
resultsCallback
(
null
,
result
,
cb
)
})
})
}
catch
(
e
)
{
console
.
error
(
e
)
}
},
function
(
err
)
{
},
function
(
err
)
{
if
(
err
)
{
if
(
err
)
{
return
next
(
err
)
return
next
(
err
)
...
@@ -109,23 +119,23 @@ export function runTestFiles(filepath, isDirectory, web3, opts = {}) {
...
@@ -109,23 +119,23 @@ export function runTestFiles(filepath, isDirectory, web3, opts = {}) {
console
.
log
(
'
\
n'
)
console
.
log
(
'
\
n'
)
if
(
totalPassing
>
0
)
{
if
(
totalPassing
>
0
)
{
console
.
log
(
(
'%c '
+
totalPassing
+
' passing '
)
+
(
'%c('
+
totalTime
+
's)'
),
'color: green'
,
'color: grey'
)
console
.
log
(
colors
.
green
(
totalPassing
+
' passing '
)
+
colors
.
grey
(
'('
+
totalTime
+
's)'
)
)
}
}
if
(
totalFailing
>
0
)
{
if
(
totalFailing
>
0
)
{
console
.
log
(
(
'%c '
+
totalFailing
+
' failing'
),
'color: red'
)
console
.
log
(
colors
.
red
(
totalFailing
+
' failing'
)
)
}
}
console
.
log
(
''
)
console
.
log
(
''
)
errors
.
forEach
((
error
,
index
)
=>
{
errors
.
forEach
((
error
,
index
)
=>
{
console
.
log
(
' '
+
(
index
+
1
)
+
') '
+
error
.
context
+
' '
+
error
.
value
)
console
.
log
(
' '
+
(
index
+
1
)
+
') '
+
error
.
context
+
' '
+
error
.
value
)
console
.
log
(
''
)
console
.
log
(
''
)
console
.
log
(
(
'%c
\
t error: '
+
error
.
errMsg
),
'color: red'
)
console
.
log
(
colors
.
red
(
'
\
t error: '
+
error
.
errMsg
)
)
})
})
console
.
log
(
''
)
console
.
log
(
''
)
next
()
next
()
})
})
}
}
],
function
()
{
],
()
=>
{
})
})
}
}
remix-tests/src/runTestSources.ts
View file @
0e561c94
...
@@ -37,7 +37,7 @@ export function runTestSources(contractSources, testCallback, resultCallback, fi
...
@@ -37,7 +37,7 @@ export function runTestSources(contractSources, testCallback, resultCallback, fi
compileContractSources
(
contractSources
,
importFileCb
,
opts
,
next
)
compileContractSources
(
contractSources
,
importFileCb
,
opts
,
next
)
},
},
function
deployAllContracts
(
compilationResult
,
next
)
{
function
deployAllContracts
(
compilationResult
,
next
)
{
deployAll
(
compilationResult
,
web3
,
function
(
err
,
contracts
)
{
deployAll
(
compilationResult
,
web3
,
(
err
,
contracts
)
=>
{
if
(
err
)
{
if
(
err
)
{
next
(
err
)
next
(
err
)
}
}
...
@@ -58,10 +58,9 @@ export function runTestSources(contractSources, testCallback, resultCallback, fi
...
@@ -58,10 +58,9 @@ export function runTestSources(contractSources, testCallback, resultCallback, fi
contractsToTest
.
push
(
contractName
)
contractsToTest
.
push
(
contractName
)
})
})
}
}
next
(
null
,
contractsToTest
,
contractsToTestDetails
,
contracts
)
next
(
null
,
contractsToTest
,
contractsToTestDetails
,
contracts
)
},
},
function
runTests
(
contractsToTest
,
contractsToTestDetails
,
contracts
,
next
)
{
function
runTests
(
contractsToTest
,
contractsToTestDetails
,
contracts
,
next
)
{
let
totalPassing
=
0
let
totalPassing
=
0
let
totalFailing
=
0
let
totalFailing
=
0
let
totalTime
=
0
let
totalTime
=
0
...
...
remix-tests/src/testRunner.ts
View file @
0e561c94
...
@@ -2,7 +2,7 @@ import async from 'async'
...
@@ -2,7 +2,7 @@ import async from 'async'
import
*
as
changeCase
from
'change-case'
import
*
as
changeCase
from
'change-case'
import
Web3
from
'web3'
import
Web3
from
'web3'
interface
CbReturn
Interface
{
export
interface
TestResult
Interface
{
type
:
string
,
type
:
string
,
value
:
any
,
value
:
any
,
time
?:
number
,
time
?:
number
,
...
@@ -10,13 +10,19 @@ interface CbReturnInterface {
...
@@ -10,13 +10,19 @@ interface CbReturnInterface {
errMsg
?:
string
errMsg
?:
string
filename
?:
string
filename
?:
string
}
}
interface
RunListInterface
{
name
:
string
,
type
:
string
,
constant
:
boolean
,
signature
?:
any
}
export
interface
ResultsInterface
{
export
interface
ResultsInterface
{
passingNum
:
number
,
passingNum
:
number
,
failureNum
:
number
,
failureNum
:
number
,
timePassed
:
number
timePassed
:
number
}
}
export
interface
TestCbInterface
{
export
interface
TestCbInterface
{
(
error
:
Error
|
null
|
undefined
,
result
?:
CbReturn
Interface
)
:
void
;
(
error
:
Error
|
null
|
undefined
,
result
:
TestResult
Interface
)
:
void
;
}
}
export
interface
ResultCbInterface
{
export
interface
ResultCbInterface
{
(
error
:
Error
|
null
|
undefined
,
result
:
ResultsInterface
)
:
void
;
(
error
:
Error
|
null
|
undefined
,
result
:
ResultsInterface
)
:
void
;
...
@@ -47,27 +53,27 @@ function getTestFunctions (jsonInterface) {
...
@@ -47,27 +53,27 @@ function getTestFunctions (jsonInterface) {
return
jsonInterface
.
filter
((
x
)
=>
specialFunctions
.
indexOf
(
x
.
name
)
<
0
&&
x
.
type
===
'function'
)
return
jsonInterface
.
filter
((
x
)
=>
specialFunctions
.
indexOf
(
x
.
name
)
<
0
&&
x
.
type
===
'function'
)
}
}
function
createRunList
(
jsonInterface
)
{
function
createRunList
(
jsonInterface
):
RunListInterface
[]
{
let
availableFunctions
=
getAvailableFunctions
(
jsonInterface
)
let
availableFunctions
=
getAvailableFunctions
(
jsonInterface
)
let
testFunctions
=
getTestFunctions
(
jsonInterface
)
let
testFunctions
=
getTestFunctions
(
jsonInterface
)
let
runList
:
any
[]
=
[]
let
runList
:
RunListInterface
[]
=
[]
if
(
availableFunctions
.
indexOf
(
'beforeAll'
)
>=
0
)
{
if
(
availableFunctions
.
indexOf
(
'beforeAll'
)
>=
0
)
{
runList
.
push
({
name
:
'beforeAll'
,
type
:
'internal'
,
constant
:
false
})
runList
.
push
({
name
:
'beforeAll'
,
type
:
'internal'
,
constant
:
false
})
}
}
for
(
let
func
of
testFunctions
)
{
for
(
let
func
of
testFunctions
)
{
if
(
availableFunctions
.
indexOf
(
'beforeEach'
)
>=
0
)
{
if
(
availableFunctions
.
indexOf
(
'beforeEach'
)
>=
0
)
{
runList
.
push
({
name
:
'beforeEach'
,
type
:
'internal'
,
constant
:
false
})
runList
.
push
({
name
:
'beforeEach'
,
type
:
'internal'
,
constant
:
false
})
}
}
runList
.
push
({
name
:
func
.
name
,
signature
:
func
.
signature
,
type
:
'test'
,
constant
:
func
.
constant
})
runList
.
push
({
name
:
func
.
name
,
signature
:
func
.
signature
,
type
:
'test'
,
constant
:
func
.
constant
})
if
(
availableFunctions
.
indexOf
(
'afterEach'
)
>=
0
)
{
if
(
availableFunctions
.
indexOf
(
'afterEach'
)
>=
0
)
{
runList
.
push
({
name
:
'afterEach'
,
type
:
'internal'
,
constant
:
false
})
runList
.
push
({
name
:
'afterEach'
,
type
:
'internal'
,
constant
:
false
})
}
}
}
}
if
(
availableFunctions
.
indexOf
(
'afterAll'
)
>=
0
)
{
if
(
availableFunctions
.
indexOf
(
'afterAll'
)
>=
0
)
{
runList
.
push
({
name
:
'afterAll'
,
type
:
'internal'
,
constant
:
false
})
runList
.
push
({
name
:
'afterAll'
,
type
:
'internal'
,
constant
:
false
})
}
}
return
runList
return
runList
...
@@ -90,7 +96,7 @@ export function runTest(testName, testObject: any, contractDetails: any, opts: a
...
@@ -90,7 +96,7 @@ export function runTest(testName, testObject: any, contractDetails: any, opts: a
signale
.
warn
(
'e.g: the following code won
\'
t work in the current context:'
)
signale
.
warn
(
'e.g: the following code won
\'
t work in the current context:'
)
signale
.
warn
(
'TestsAccounts.getAccount('
+
opts
.
accounts
.
length
+
')'
)
signale
.
warn
(
'TestsAccounts.getAccount('
+
opts
.
accounts
.
length
+
')'
)
}
}
const
resp
:
CbReturn
Interface
=
{
const
resp
:
TestResult
Interface
=
{
type
:
'contract'
,
type
:
'contract'
,
value
:
testName
,
value
:
testName
,
filename
:
testObject
.
filename
filename
:
testObject
.
filename
...
@@ -113,7 +119,7 @@ export function runTest(testName, testObject: any, contractDetails: any, opts: a
...
@@ -113,7 +119,7 @@ export function runTest(testName, testObject: any, contractDetails: any, opts: a
method
.
call
(
sendParams
).
then
((
result
)
=>
{
method
.
call
(
sendParams
).
then
((
result
)
=>
{
let
time
=
Math
.
ceil
((
Date
.
now
()
-
startTime
)
/
1000.0
)
let
time
=
Math
.
ceil
((
Date
.
now
()
-
startTime
)
/
1000.0
)
if
(
result
)
{
if
(
result
)
{
const
resp
:
CbReturn
Interface
=
{
const
resp
:
TestResult
Interface
=
{
type
:
'testPass'
,
type
:
'testPass'
,
value
:
changeCase
.
sentenceCase
(
func
.
name
),
value
:
changeCase
.
sentenceCase
(
func
.
name
),
time
:
time
,
time
:
time
,
...
@@ -123,7 +129,7 @@ export function runTest(testName, testObject: any, contractDetails: any, opts: a
...
@@ -123,7 +129,7 @@ export function runTest(testName, testObject: any, contractDetails: any, opts: a
passingNum
+=
1
passingNum
+=
1
timePassed
+=
time
timePassed
+=
time
}
else
{
}
else
{
const
resp
:
CbReturn
Interface
=
{
const
resp
:
TestResult
Interface
=
{
type
:
'testFailure'
,
type
:
'testFailure'
,
value
:
changeCase
.
sentenceCase
(
func
.
name
),
value
:
changeCase
.
sentenceCase
(
func
.
name
),
time
:
time
,
time
:
time
,
...
@@ -147,7 +153,7 @@ export function runTest(testName, testObject: any, contractDetails: any, opts: a
...
@@ -147,7 +153,7 @@ export function runTest(testName, testObject: any, contractDetails: any, opts: a
if
(
event
.
raw
.
topics
.
indexOf
(
topic
)
>=
0
)
{
if
(
event
.
raw
.
topics
.
indexOf
(
topic
)
>=
0
)
{
var
testEvent
=
web3
.
eth
.
abi
.
decodeParameters
([
'bool'
,
'string'
],
event
.
raw
.
data
)
var
testEvent
=
web3
.
eth
.
abi
.
decodeParameters
([
'bool'
,
'string'
],
event
.
raw
.
data
)
if
(
!
testEvent
[
0
])
{
if
(
!
testEvent
[
0
])
{
const
resp
:
CbReturn
Interface
=
{
const
resp
:
TestResult
Interface
=
{
type
:
'testFailure'
,
type
:
'testFailure'
,
value
:
changeCase
.
sentenceCase
(
func
.
name
),
value
:
changeCase
.
sentenceCase
(
func
.
name
),
time
:
time
,
time
:
time
,
...
@@ -163,7 +169,7 @@ export function runTest(testName, testObject: any, contractDetails: any, opts: a
...
@@ -163,7 +169,7 @@ export function runTest(testName, testObject: any, contractDetails: any, opts: a
}
}
if
(
testPassed
)
{
if
(
testPassed
)
{
const
resp
:
CbReturn
Interface
=
{
const
resp
:
TestResult
Interface
=
{
type
:
'testPass'
,
type
:
'testPass'
,
value
:
changeCase
.
sentenceCase
(
func
.
name
),
value
:
changeCase
.
sentenceCase
(
func
.
name
),
time
:
time
,
time
:
time
,
...
@@ -175,8 +181,7 @@ export function runTest(testName, testObject: any, contractDetails: any, opts: a
...
@@ -175,8 +181,7 @@ export function runTest(testName, testObject: any, contractDetails: any, opts: a
return
next
()
return
next
()
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
'error!'
)
console
.
error
(
err
)
console
.
dir
(
err
)
return
next
(
err
)
return
next
(
err
)
}
}
}).
on
(
'error'
,
function
(
err
:
Error
|
null
|
undefined
)
{
}).
on
(
'error'
,
function
(
err
:
Error
|
null
|
undefined
)
{
...
...
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