-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
868118f
commit 9870fea
Showing
5 changed files
with
669 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ node_modules | |
yarn-error.log | ||
cli.js | ||
Avo.js | ||
reporter.js | ||
reporter.js | ||
reporter.test.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { expect, test, vi } from 'vitest'; // eslint-disable-line import/no-extraneous-dependencies | ||
import { tree } from './reporter.js'; | ||
|
||
test('tree', () => { | ||
const consoleSpy = vi.spyOn(console, 'log'); | ||
tree('testing', []); | ||
expect(consoleSpy).toHaveBeenCalledWith('testing\n'); | ||
|
||
tree('testing', [{ name: 'firstNode' }]); | ||
expect(consoleSpy).toHaveBeenCalledWith(`testing | ||
└─ firstNode | ||
`); | ||
|
||
tree('testing', [{ name: 'firstNode', children: [{ name: 'secondNode' }] }]); | ||
expect(consoleSpy).toHaveBeenCalledWith(`testing | ||
└─ firstNode | ||
└─ secondNode | ||
`); | ||
|
||
tree('testing', [ | ||
{ | ||
name: 'firstNode', | ||
children: [{ name: 'secondNode' }, { name: 'thirdNode' }], | ||
}, | ||
]); | ||
expect(consoleSpy).toHaveBeenCalledWith(`testing | ||
└─ firstNode | ||
├─ secondNode | ||
└─ thirdNode | ||
`); | ||
|
||
tree('testing', [ | ||
{ | ||
name: 'firstNode', | ||
children: [ | ||
{ name: 'secondNode', children: [{ name: 'secondNodeChild' }] }, | ||
{ name: 'thirdNode' }, | ||
], | ||
}, | ||
]); | ||
expect(consoleSpy).toHaveBeenCalledWith(`testing | ||
└─ firstNode | ||
├─ secondNode | ||
│ └─ secondNodeChild | ||
└─ thirdNode | ||
`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.