Skip to content

Commit

Permalink
fix: ci flakiness (#1423)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbnayax committed Jun 12, 2024
1 parent 0f17df2 commit 42075d6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
24 changes: 20 additions & 4 deletions test/doctor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,16 @@ describe('doctor', function () {
await fs.rm(lockfilePath, { recursive: true, force: true })
await fs.rm(nodeModulesPath, { recursive: true, force: true })

// stderr should be empty
stderr.should.equal('')
stderr = stripAnsi(stderr).trim()
if (stderr !== '') {
stderr.should.equal(`> test
> node test.js
> test
> node test.js`)
}

// stdout should include normal output
stripAnsi(stdout).should.containIgnoreCase('Tests pass')
Expand Down Expand Up @@ -154,8 +162,16 @@ describe('doctor', function () {
await fs.rm(lockfilePath, { recursive: true, force: true })
await fs.rm(nodeModulesPath, { recursive: true, force: true })

// stderr should be empty
stderr.should.equal('')
stderr = stripAnsi(stderr).trim()
if (stderr !== '') {
stripAnsi(stderr).should.equal(`> test
> echo 'Test Success'
> test
> echo 'Test Success'`)
}

// stdout should include normal output
stripAnsi(stdout).should.containIgnoreCase('Tests pass')
Expand Down
11 changes: 10 additions & 1 deletion test/helpers/doctorHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,16 @@ export const testPass = ({ packageManager }: { packageManager: PackageManagerNam
if (packageManager === 'bun') {
stripAnsi(stderr).should.equal('$ echo Success\n\n$ echo Success\n\n')
} else {
stderr.should.equal('')
stderr = stripAnsi(stderr).trim()
if (stderr !== '') {
stderr.should.equal(`> test
> echo Success
> test
> echo Success`)
}
}

// stdout should include normal output
Expand Down

0 comments on commit 42075d6

Please sign in to comment.