Skip to content

Commit

Permalink
Move call to readAllStdinSync earlier during initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
PyvesB committed Jun 20, 2021
1 parent c461cb1 commit 4b23b29
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions core/service-test-runner/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ import('../unhandled-rejection.spec.js')
const retry = {}
retry.count = parseInt(process.env.RETRY_COUNT) || 0
retry.backoff = parseInt(process.env.RETRY_BACKOFF) || 0

const args = minimist(process.argv.slice(3))
const stdinOption = args.stdin
const onlyOption = args.only
let onlyServices
if (stdinOption && onlyOption) {
console.error('Do not use --only with --stdin')
} else if (stdinOption) {
const allStdin = readAllStdinSync().trim()
onlyServices = allStdin ? allStdin.split('\n') : []
} else if (onlyOption) {
onlyServices = onlyOption.split(',')
}

let baseUrl, server
if (process.env.TESTED_SERVER_URL) {
baseUrl = process.env.TESTED_SERVER_URL
Expand Down Expand Up @@ -99,21 +113,6 @@ if (!process.env.TESTED_SERVER_URL) {
}
}

const args = minimist(process.argv.slice(3))
const stdinOption = args.stdin
const onlyOption = args.only

let onlyServices

if (stdinOption && onlyOption) {
console.error('Do not use --only with --stdin')
} else if (stdinOption) {
const allStdin = readAllStdinSync().trim()
onlyServices = allStdin ? allStdin.split('\n') : []
} else if (onlyOption) {
onlyServices = onlyOption.split(',')
}

if (typeof onlyServices === 'undefined' || onlyServices.includes('*****')) {
console.info('Running all service tests.')
} else if (onlyServices.length === 0) {
Expand Down

0 comments on commit 4b23b29

Please sign in to comment.