File tree Expand file tree Collapse file tree 2 files changed +26
-6
lines changed
Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Original file line number Diff line number Diff line change 2626 runs-on : ${{ matrix.os }}
2727
2828 permissions :
29- # Required to checkout the code
30- contents : read
29+ # Required to checkout the code and push coverage badge updates
30+ contents : write
3131 # Required to put a comment into the pull-request
3232 pull-requests : write
3333
Original file line number Diff line number Diff line change 33 * Runs before all tests to configure the testing environment
44 */
55
6- import { beforeAll } from 'vitest'
6+ import { beforeEach , vi } from 'vitest'
77
8- beforeAll ( ( ) => {
9- // Setup global test environment
10- // Note: nitro-graphql/* imports are aliased in vitest.config.ts
8+ // Mock consola globally to suppress expected error logs during tests
9+ vi . mock ( 'consola' , async ( importOriginal ) => {
10+ const actual = await importOriginal < typeof import ( 'consola' ) > ( )
11+ const mockLogger = {
12+ ...actual . default ,
13+ error : vi . fn ( ) ,
14+ warn : vi . fn ( ) ,
15+ info : vi . fn ( ) ,
16+ success : vi . fn ( ) ,
17+ debug : vi . fn ( ) ,
18+ log : vi . fn ( ) ,
19+ withTag : vi . fn ( ( ) => mockLogger ) ,
20+ }
21+ return {
22+ ...actual ,
23+ default : mockLogger ,
24+ consola : mockLogger ,
25+ }
26+ } )
27+
28+ // Also suppress console.error for expected errors during tests
29+ beforeEach ( ( ) => {
30+ vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1131} )
You can’t perform that action at this time.
0 commit comments