Skip to content

Commit

Permalink
chore(testing dbAuth): provide mock implementations (redwoodjs#10818)
Browse files Browse the repository at this point in the history
When running the dbAuth tests for `yarn rw g dbAuth` you'd get these
scary looking red console printouts
<img width="720" alt="image"
src="https://github.com/redwoodjs/redwood/assets/30793/e3c398c3-8db7-4933-84cc-9ebb81feff3d">

This PR adds mock implementations for `process.exit` and `console.info`
to silence that output
  • Loading branch information
Tobbe committed Jun 15, 2024
1 parent fb1efbc commit b75cdc2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ describe('dbAuth', () => {

describe('handler', () => {
it('exits when all files are skipped', async () => {
const mockExit = vi.spyOn(process, 'exit').mockImplementation()
const mockConsoleInfo = vi.spyOn(console, 'info').mockImplementation()
const mockExit = vi.spyOn(process, 'exit').mockImplementation(() => {})
const mockConsoleInfo = vi
.spyOn(console, 'info')
.mockImplementation(() => {})

await dbAuth.handler({
listr2: { silentRendererCondition: true },
Expand Down

0 comments on commit b75cdc2

Please sign in to comment.