1- import { afterEach , beforeEach , describe , expect , it , vi } from 'vitest' ;
2- import { type Audit , categoryRefSchema } from '@code-pushup/models' ;
3- import { AUDITS } from './constants.js' ;
1+ import { describe , expect , it } from 'vitest' ;
2+ import { type Audit , categoryRefSchema } from '@code-pushup/models' ;
3+ import { ui } from '@code-pushup/utils' ;
4+ import { AUDITS } from './constants.js' ;
45import {
56 filterAuditsByCompilerOptions ,
67 filterAuditsBySlug ,
@@ -99,31 +100,21 @@ describe('getCategoryRefsFromGroups', () => {
99100
100101 it ( 'should return all groups as categoryRefs if compiler options are given' , async ( ) => {
101102 const categoryRefs = await getCategoryRefsFromGroups ( {
102- tsConfigPath : 'tsconfig.json' ,
103+ tsconfig : 'tsconfig.json' ,
103104 } ) ;
104105 expect ( categoryRefs ) . toHaveLength ( 3 ) ;
105106 } ) ;
106107
107108 it ( 'should return a subset of all groups as categoryRefs if compiler options contain onlyAudits filter' , async ( ) => {
108109 const categoryRefs = await getCategoryRefsFromGroups ( {
109- tsConfigPath : 'tsconfig.json' ,
110+ tsconfig : 'tsconfig.json' ,
110111 onlyAudits : [ 'semantic-errors' ] ,
111112 } ) ;
112113 expect ( categoryRefs ) . toHaveLength ( 1 ) ;
113114 } ) ;
114115} ) ;
115116
116117describe ( 'logSkippedAudits' , ( ) => {
117- beforeEach ( ( ) => {
118- vi . mock ( 'console' , ( ) => ( {
119- warn : vi . fn ( ) ,
120- } ) ) ;
121- } ) ;
122-
123- afterEach ( ( ) => {
124- vi . restoreAllMocks ( ) ;
125- } ) ;
126-
127118 it ( 'should not warn when all audits are included' , ( ) => {
128119 logSkippedAudits ( AUDITS ) ;
129120
@@ -133,18 +124,15 @@ describe('logSkippedAudits', () => {
133124 it ( 'should warn about skipped audits' , ( ) => {
134125 logSkippedAudits ( AUDITS . slice ( 0 , - 1 ) ) ;
135126
136- expect ( console . warn ) . toHaveBeenCalledTimes ( 1 ) ;
137- expect ( console . warn ) . toHaveBeenCalledWith (
127+ expect ( ui ( ) ) . toHaveLogged (
128+ 'info' ,
138129 expect . stringContaining ( `Skipped audits: [` ) ,
139130 ) ;
140131 } ) ;
141132
142133 it ( 'should camel case the slugs in the audit message' , ( ) => {
143134 logSkippedAudits ( AUDITS . slice ( 0 , - 1 ) ) ;
144135
145- expect ( console . warn ) . toHaveBeenCalledTimes ( 1 ) ;
146- expect ( console . warn ) . toHaveBeenCalledWith (
147- expect . stringContaining ( `unknownCodes` ) ,
148- ) ;
136+ expect ( ui ( ) ) . toHaveLogged ( 'info' , expect . stringContaining ( `unknownCodes` ) ) ;
149137 } ) ;
150138} ) ;
0 commit comments