Skip to content

Commit

Permalink
Merge pull request #1870 from SUI-Components/no-coverage-inline
Browse files Browse the repository at this point in the history
FEAT (sui-test & sui-studio) binary option: no coverage inline
  • Loading branch information
kikoruiz authored Nov 14, 2024
2 parents 4af7fd9 + 5cefcf4 commit e0bf9e4
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 38 deletions.
94 changes: 60 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion packages/sui-studio/bin/sui-studio-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ program
.option('-W, --watch', 'Watch mode')
.option('-T, --timeout <timeout>', 'Timeout')
.option('--coverage', 'Create coverage', false)
.option('--no-coverage-inline', 'Save the coverage summary in a text file', false)
.on('--help', () => {
console.log(' Examples:')
console.log('')
Expand All @@ -23,7 +24,7 @@ program
})
.parse(process.argv)

const {coverage, watch, ci, headless, timeout} = program.opts()
const {coverage, coverageInline, watch, ci, headless, timeout} = program.opts()

const relPath = path.relative(
process.cwd(),
Expand All @@ -39,6 +40,7 @@ const run = async () => {
'--pattern',
path.join(relPath, 'node_modules', '@s-ui', 'studio', 'src', 'runtime-mocha', 'index.js'),
coverage && '--coverage',
!coverageInline && '--no-coverage-inline',
watch && '--watch',
ci && '--ci',
headless && '--headless',
Expand Down
20 changes: 18 additions & 2 deletions packages/sui-test/bin/karma/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ const {
const config = require('./config.js')
const CWD = process.cwd()

module.exports = async ({ci, coverage, headless, ignorePattern, pattern, srcPattern, timeout, watch}) => {
module.exports = async ({
ci,
coverage,
coverageInline,
headless,
ignorePattern,
pattern,
srcPattern,
timeout,
watch
}) => {
if (timeout) config.browserDisconnectTimeout = timeout
if (ignorePattern) config.exclude = [ignorePattern]

Expand Down Expand Up @@ -38,7 +48,13 @@ module.exports = async ({ci, coverage, headless, ignorePattern, pattern, srcPatt
{type: 'cobertura', subdir: '.', file: 'coverage.xml'},
{type: 'html', subdir: 'report-html'},
{type: 'json-summary', subdir: '.', file: 'coverage.json'},
{type: 'text-summary'}
{
type: 'text-summary',
...(!coverageInline && {
subdir: '.',
file: 'coverage.txt'
})
}
]
}
}
Expand Down
7 changes: 6 additions & 1 deletion packages/sui-test/bin/sui-test-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ program
.option('--src-pattern <srcPattern>', 'Define the source directory', false)
.option('-T, --timeout <ms>', 'Timeout', 2000)
.option('--coverage', 'Run the coverage preprocessor', false)
.option('--no-coverage-inline', 'Save the coverage summary in a text file', false)
.on('--help', () => {
console.log(' Description:')
console.log('')
Expand All @@ -22,15 +23,19 @@ program
console.log(' Examples:')
console.log('')
console.log(' $ sui-test browser')
console.log(' $ sui-test browser --headless')
console.log(' $ sui-test browser --coverage')
console.log(' $ sui-test browser --coverage --no-coverage-inline')
console.log('')
})
.parse(process.argv)

const {ci, coverage, headless, ignorePattern, pattern, srcPattern, timeout, watch} = program.opts()
const {ci, coverage, coverageInline, headless, ignorePattern, pattern, srcPattern, timeout, watch} = program.opts()

runner({
ci,
coverage,
coverageInline,
headless,
ignorePattern,
pattern,
Expand Down

0 comments on commit e0bf9e4

Please sign in to comment.