Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4074953
check-excludes.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
check-excludes.js
View Options
'use strict'
;
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
karmaConfigPath
=
path
.
join
(
__dirname
,
'../karma.conf.js'
);
const
coverageFile
=
path
.
join
(
__dirname
,
'../coverage/coverage-summary.json'
);
if
(
!
fs
.
existsSync
(
coverageFile
)
)
{
throw
new
Error
(
`Coverage summary not found at
${
coverageFile
}
`
);
}
const
coverageData
=
JSON
.
parse
(
fs
.
readFileSync
(
coverageFile
,
'utf8'
)
);
const
karmaConfig
=
require
(
karmaConfigPath
);
let
configObject
=
{};
karmaConfig
(
{
set
:
(
cfg
)
=>
{
configObject
=
cfg
;
}
}
);
const
thresholdsGlobal
=
configObject
.
coverageReporter
.
check
.
global
;
const
excludes
=
configObject
.
coverageReporter
.
check
.
each
.
excludes
||
[];
const
overrides
=
configObject
.
coverageReporter
.
check
.
each
.
overrides
||
{};
const
minimatch
=
require
(
'minimatch'
);
const
meetsThresholds
=
[];
excludes
.
forEach
(
(
file
)
=>
{
const
absoluteFile
=
path
.
resolve
(
process
.
cwd
(),
file
);
const
coverage
=
coverageData
[
absoluteFile
];
if
(
!
coverage
)
{
return
;
}
// Find matching override pattern (last match wins)
let
thresholds
=
thresholdsGlobal
;
for
(
const
[
pattern
,
override
]
of
Object
.
entries
(
overrides
)
)
{
if
(
minimatch
(
file
,
pattern
)
)
{
thresholds
=
override
;
}
}
if
(
Object
.
entries
(
thresholds
).
every
(
(
[
metric
,
min
]
)
=>
coverage
[
metric
].
pct
>=
min
)
)
{
meetsThresholds
.
push
(
file
);
}
}
);
if
(
!
meetsThresholds
.
length
)
{
console
.
log
(
'No excluded files meet their thresholds.'
);
}
else
{
console
.
log
(
'Excluded files which meet their thresholds:'
);
meetsThresholds
.
forEach
(
(
f
)
=>
console
.
log
(
`-
${
f
}
`
)
);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Aug 17 2026, 17:14 (10 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
85/15/8c2072e59b16ae5b166cf09768b7
Default Alt Text
check-excludes.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment