Skip to content
This repository was archived by the owner on Feb 5, 2024. It is now read-only.

feat: silent plan generation on CI #71

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import singletonAllureInstance from './singletonAllureInstance'
import currentActionContext from './currentActionContext'
import { isPendingError } from './PendingError'

const runInCI = Boolean(process.env.CI)

function main(args) {
const testModulePath = require('fs').realpathSync(args._[0])
const result = cosmiconfig('prescript').searchSync(
Expand Down Expand Up @@ -255,7 +257,10 @@ function runNonInteractiveMode(
requestedTestName: string | null,
config: ResolvedConfig
) {
console.log(chalk.bold.yellow('## Generating test plan...'))
if (!runInCI) {
console.log(chalk.bold.yellow('## Generating test plan...'))
}

const tests = singleton
.loadTests(
() => {
Expand All @@ -275,12 +280,14 @@ function runNonInteractiveMode(
process.exitCode = 3
return
}
console.log(
chalk.dim('* ') + chalk.green('Test plan generated successfully.')
)
console.log()
if (!runInCI) {
console.log(
chalk.dim('* ') + chalk.green('Test plan generated successfully.')
)
console.log()

console.log(chalk.bold.yellow('## Running tests...'))
console.log(chalk.bold.yellow('## Running tests...'))
}
runTest().catch(e =>
setTimeout(() => {
throw e
Expand All @@ -295,7 +302,7 @@ function runNonInteractiveMode(
)
const iterationListener: IIterationListener = {
onEnter: node => reporter.onEnterStep(node),
onExit: (node, error) => reporter.onExitStep(node, error)
onExit: (node, error) => reporter.onExitStep(node, error),
}
const tester = createTestIterator(createLogVisitor(), iterationListener)
const errors: Error[] = []
Expand Down