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
3e09b6f1
Commit
3e09b6f1
authored
Aug 31, 2020
by
aniket-engg
Committed by
Aniket
Aug 31, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remix-tests CLI improvements
parent
bb0d7f38
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
11 deletions
+31
-11
compiler.ts
libs/remix-tests/src/compiler.ts
+12
-0
run.ts
libs/remix-tests/src/run.ts
+19
-11
No files found.
libs/remix-tests/src/compiler.ts
View file @
3e09b6f1
import
fs
from
'./fileSystem'
import
async
from
'async'
import
path
from
'path'
import
Log
from
'./logger'
const
logger
=
new
Log
()
const
log
=
logger
.
logger
import
{
Compiler
as
RemixCompiler
}
from
'@remix-project/remix-solidity'
import
{
SrcIfc
,
CompilerConfiguration
,
CompilationErrors
}
from
'./types'
...
...
@@ -100,12 +103,21 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts:
}
}
else
{
// walkSync only if it is a directory
let
solFileCount
=
0
;
fs
.
walkSync
(
filepath
,
(
foundpath
:
string
)
=>
{
// only process .sol files
if
(
foundpath
.
split
(
'.'
).
pop
()
===
'sol'
)
{
solFileCount
++
;
processFile
(
foundpath
,
sources
,
true
)
}
})
if
(
solFileCount
>
0
)
{
log
.
info
(
`
${
solFileCount
}
Solidity files found`
)
}
else
{
log
.
error
(
`No Solidity files found`
)
process
.
exit
()
}
}
}
catch
(
e
)
{
// eslint-disable-line no-useless-catch
...
...
libs/remix-tests/src/run.ts
View file @
3e09b6f1
...
...
@@ -36,34 +36,42 @@ commander.command('help').description('output usage information').action(functio
// get current version
commander
.
option
(
'-v, --verbose <level>'
,
'run with verbosity'
,
mapVerbosity
)
.
action
(
async
(
filename
)
=>
{
if
(
!
filename
.
endsWith
(
'_test.sol'
)){
.
action
(
async
(
testsPath
)
=>
{
// Check if path exists
if
(
!
fs
.
existsSync
(
testsPath
))
{
console
.
error
(
testsPath
+
' not found'
)
process
.
exit
(
1
)
}
// Check if path is for a directory
const
isDirectory
=
fs
.
lstatSync
(
testsPath
).
isDirectory
()
// If path is for a file, file name must have `_test.sol` suffix
if
(
!
isDirectory
&&
!
testsPath
.
endsWith
(
'_test.sol'
))
{
log
.
error
(
'Test filename should end with "_test.sol"'
)
process
.
exit
()
}
// Console message
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
)
{
logger
.
setVerbosity
(
commander
.
verbose
)
log
.
info
(
'verbosity level set to '
+
commander
.
verbose
.
blue
)
}
const
web3
=
new
Web3
()
const
provider
:
any
=
new
Provider
()
await
provider
.
init
()
web3
.
setProvider
(
provider
)
if
(
!
fs
.
existsSync
(
filename
))
{
console
.
error
(
filename
+
' not found'
)
process
.
exit
(
1
)
}
const
isDirectory
=
fs
.
lstatSync
(
filename
).
isDirectory
()
runTestFiles
(
path
.
resolve
(
filename
),
isDirectory
,
web3
)
runTestFiles
(
path
.
resolve
(
testsPath
),
isDirectory
,
web3
)
})
if
(
!
process
.
argv
.
slice
(
2
).
length
)
{
log
.
error
(
'Please specify a file
name
'
)
log
.
error
(
'Please specify a file
or directory path
'
)
process
.
exit
()
}
...
...
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