Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
d8d41bcb
Unverified
Commit
d8d41bcb
authored
Jul 10, 2023
by
OptimismBot
Committed by
GitHub
Jul 10, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6240 from ethereum-optimism/cleanup/ctb-remove-glob-dep
contracts-bedrock: remove glob dependency
parents
af8a1ff5
d5bc9c13
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
17 deletions
+53
-17
package.json
packages/contracts-bedrock/package.json
+0
-1
forge-test-names.ts
packages/contracts-bedrock/scripts/forge-test-names.ts
+53
-13
pnpm-lock.yaml
pnpm-lock.yaml
+0
-3
No files found.
packages/contracts-bedrock/package.json
View file @
d8d41bcb
...
@@ -48,7 +48,6 @@
...
@@ -48,7 +48,6 @@
"@typescript-eslint/parser"
:
"^5.60.1"
,
"@typescript-eslint/parser"
:
"^5.60.1"
,
"ds-test"
:
"github:dapphub/ds-test#c9ce3f25bde29fc5eb9901842bf02850dfd2d084"
,
"ds-test"
:
"github:dapphub/ds-test#c9ce3f25bde29fc5eb9901842bf02850dfd2d084"
,
"forge-std"
:
"github:foundry-rs/forge-std#e8a047e3f40f13fa37af6fe14e6e06283d9a060e"
,
"forge-std"
:
"github:foundry-rs/forge-std#e8a047e3f40f13fa37af6fe14e6e06283d9a060e"
,
"glob"
:
"^7.1.6"
,
"solhint"
:
"^3.4.1"
,
"solhint"
:
"^3.4.1"
,
"solhint-plugin-prettier"
:
"^0.0.5"
,
"solhint-plugin-prettier"
:
"^0.0.5"
,
"ts-node"
:
"^10.9.1"
,
"ts-node"
:
"^10.9.1"
,
...
...
packages/contracts-bedrock/scripts/forge-test-names.ts
View file @
d8d41bcb
import
fs
from
'
fs
'
import
fs
from
'
fs
'
import
path
from
'
path
'
import
{
glob
}
from
'
glob
'
import
{
execSync
}
from
'
child_process
'
/**
/**
* Series of function name checks.
* Series of function name checks.
...
@@ -59,27 +59,67 @@ const checks: Array<{
...
@@ -59,27 +59,67 @@ const checks: Array<{
* Script for checking that all test functions are named correctly.
* Script for checking that all test functions are named correctly.
*/
*/
const
main
=
async
()
=>
{
const
main
=
async
()
=>
{
const
result
=
execSync
(
'
forge config --json
'
)
const
config
=
JSON
.
parse
(
result
.
toString
())
const
out
=
config
.
out
||
'
out
'
const
paths
=
[]
const
readFilesRecursively
=
(
dir
:
string
)
=>
{
const
files
=
fs
.
readdirSync
(
dir
)
for
(
const
file
of
files
)
{
const
filePath
=
path
.
join
(
dir
,
file
)
const
fileStat
=
fs
.
statSync
(
filePath
)
if
(
fileStat
.
isDirectory
())
{
readFilesRecursively
(
filePath
)
}
else
{
paths
.
push
(
filePath
)
}
}
}
readFilesRecursively
(
out
)
console
.
log
(
'
Success:
'
)
const
errors
:
string
[]
=
[]
const
errors
:
string
[]
=
[]
const
files
=
glob
.
sync
(
'
./forge-artifacts/**/*.t.sol/*Test*.json
'
)
for
(
const
file
of
files
)
{
for
(
const
filepath
of
paths
)
{
const
artifact
=
JSON
.
parse
(
fs
.
readFileSync
(
file
,
'
utf8
'
))
const
artifact
=
JSON
.
parse
(
fs
.
readFileSync
(
filepath
,
'
utf8
'
))
let
isTest
=
false
for
(
const
element
of
artifact
.
abi
)
{
for
(
const
element
of
artifact
.
abi
)
{
// Skip non-functions and functions that don't start with "test".
if
(
element
.
name
===
'
IS_TEST
'
)
{
if
(
element
.
type
!==
'
function
'
||
!
element
.
name
.
startsWith
(
'
test
'
))
{
isTest
=
true
continue
break
}
}
}
if
(
isTest
)
{
let
success
=
true
for
(
const
element
of
artifact
.
abi
)
{
// Skip non-functions and functions that don't start with "test".
if
(
element
.
type
!==
'
function
'
||
!
element
.
name
.
startsWith
(
'
test
'
))
{
continue
}
// Check the rest.
// Check the rest.
for
(
const
{
check
,
error
}
of
checks
)
{
for
(
const
{
check
,
error
}
of
checks
)
{
if
(
!
check
(
element
.
name
.
split
(
'
_
'
)))
{
if
(
!
check
(
element
.
name
.
split
(
'
_
'
)))
{
errors
.
push
(
`in
${
file
}
function
${
element
.
name
}
:
${
error
}
`
)
errors
.
push
(
`
${
filepath
}
function
${
element
.
name
}
:
${
error
}
`
)
success
=
false
}
}
}
}
}
if
(
success
)
{
console
.
log
(
` -
${
path
.
parse
(
filepath
).
name
}
`
)
}
}
}
}
}
if
(
errors
.
length
>
0
)
{
if
(
errors
.
length
>
0
)
{
console
.
error
(
...
errors
)
console
.
error
(
errors
.
join
(
'
\n
'
)
)
process
.
exit
(
1
)
process
.
exit
(
1
)
}
}
}
}
...
...
pnpm-lock.yaml
View file @
d8d41bcb
...
@@ -277,9 +277,6 @@ importers:
...
@@ -277,9 +277,6 @@ importers:
forge-std
:
forge-std
:
specifier
:
github:foundry-rs/forge-std#e8a047e3f40f13fa37af6fe14e6e06283d9a060e
specifier
:
github:foundry-rs/forge-std#e8a047e3f40f13fa37af6fe14e6e06283d9a060e
version
:
github.com/foundry-rs/forge-std/e8a047e3f40f13fa37af6fe14e6e06283d9a060e
version
:
github.com/foundry-rs/forge-std/e8a047e3f40f13fa37af6fe14e6e06283d9a060e
glob
:
specifier
:
^7.1.6
version
:
7.1.6
solhint
:
solhint
:
specifier
:
^3.4.1
specifier
:
^3.4.1
version
:
3.4.1
version
:
3.4.1
...
...
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