Skip to content

Commit

Permalink
feat(job): supports URL parameters for testsuite (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBuchholz committed Feb 6, 2024
1 parent bc214e1 commit 062f8c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function getCommand (cwd) {
.option('--mappings <mapping...>', '[💻] Custom mapping (<match>=<file|url>(<config>))', arrayOf(mapping))
.option('--cache <path>', '[💻] Cache UI5 resources locally in the given folder (empty to disable)')
.option('--webapp <path>', '[💻] Base folder of the web application (relative to cwd)', 'webapp')
.option('--testsuite <path>', '[💻] Path of the testsuite file (relative to webapp)', 'test/testsuite.qunit.html')
.option('--testsuite <path>', '[💻] Path of the testsuite file (relative to webapp, URL parameters are supported)', 'test/testsuite.qunit.html')
.option('-w, --watch [flag]', '[💻] Monitor the webapp folder and re-execute tests on change', boolean, false)

// Specific to coverage in url mode (experimental)
Expand Down Expand Up @@ -227,7 +227,9 @@ function finalize (job) {
job.mode = buildAndCheckMode(job)
if (job.mode === 'legacy') {
checkAccess({ path: job.webapp, label: 'webapp folder' })
const testsuitePath = toAbsolute(job.testsuite, job.webapp)

const [, testsuiteFile] = job.testsuite.match(/([^?]*)(\?.*)?$/)
const testsuitePath = toAbsolute(testsuiteFile, job.webapp)
checkAccess({ path: testsuitePath, label: 'testsuite', file: true })
} else if (job.mode === 'url') {
if (job[$valueSources].coverage !== 'cli') {
Expand Down
6 changes: 6 additions & 0 deletions src/job.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ describe('job', () => {
})).toThrow()
})

it('supports parameters for testsuite (stripping ?)', () => {
expect(() => buildJob({
testsuite: 'test/testsuite.qunit.html?a=b'
})).not.toThrow()
})

it('fails on a missing file (points to a folder)', () => {
expect(() => buildJob({
testsuite: 'lib'
Expand Down

0 comments on commit 062f8c6

Please sign in to comment.