FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
expr/.github/scripts/coverage.mjs at master · netliomax25-code/expr · GitHub
netliomax25-code
/
expr
Public
forked from
expr-lang/expr
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
expr
/
.github
/
scripts
/
coverage.mjs
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
39 lines (35 loc) · 1.44 KB
Breadcrumbs
expr
/
.github
/
scripts
/
coverage.mjs
Copy path
File metadata and controls
executable file
·
39 lines (35 loc) · 1.44 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env zx
const
expected
=
90
const
exclude
=
[
'expr/test'
,
// We do not need to test the test package.
'checker/mock'
,
// Mocks only used for testing.
'vm/func_types'
,
// Generated files.
'vm/runtime/helpers'
,
// Generated files.
'internal/difflib'
,
// Test dependency. This is vendored dependency, and ideally we also have good tests for it.
'internal/spew'
,
// Test dependency.
'internal/testify'
,
// Test dependency.
'patcher/value'
,
// Contains a lot of repeating code. Ideally we should have a test for it.
'pro'
,
// Expr Pro is not a part of the main codebase.
]
cd
(
path
.
resolve
(
__dirname
,
'..'
,
'..'
)
)
await
spinner
(
'Running tests'
,
async
(
)
=>
{
await
$
`go test -coverprofile=coverage.out -coverpkg=github.com/expr-lang/expr/... ./...`
const
coverage
=
fs
.
readFileSync
(
'coverage.out'
)
.
toString
(
)
.
split
(
'\n'
)
.
filter
(
line
=>
{
for
(
const
ex
of
exclude
)
if
(
line
.
includes
(
ex
)
)
return
false
return
true
}
)
.
join
(
'\n'
)
fs
.
writeFileSync
(
'coverage.out'
,
coverage
)
await
$
`go tool cover -html=coverage.out -o coverage.html`
}
)
const
cover
=
await
$
(
{
verbose
:
true
}
)
`go tool cover -func=coverage.out`
const
total
=
+
cover
.
stdout
.
match
(
/
t
o
t
a
l
:
\s
+
\(
s
t
a
t
e
m
e
n
t
s
\)
\s
+
(
\d
+
\.
\d
+
)
%
/
)
[
1
]
if
(
total
<
expected
)
{
echo
(
chalk
.
red
(
`Coverage is too low:
${
total
}
% <
${
expected
}
% (expected)`
)
)
process
.
exit
(
1
)
}
else
{
echo
(
`Coverage is good:
${
chalk
.
green
(
total
+
'%'
)
}
>=
${
expected
}
% (expected)`
)
}
Back
|
FazBrowse Home
|
New Git URL