1- import { bundle , getTotals , getMergedConfig , Config } from '@redocly/openapi-core' ;
1+ import { bundle , getTotals , getMergedConfig , Config , logger } from '@redocly/openapi-core' ;
22
33import { BundleOptions , handleBundle } from '../../commands/bundle.js' ;
44import {
@@ -17,16 +17,12 @@ import { type Arguments } from 'yargs';
1717describe ( 'bundle' , ( ) => {
1818 let processExitMock : MockInstance ;
1919 let exitCb : any ;
20- let stderrWriteMock : any ;
21- let stdoutWriteMock : any ;
2220 beforeEach ( async ( ) => {
2321 processExitMock = vi . spyOn ( process , 'exit' ) . mockImplementation ( vi . fn ( ) as any ) ;
2422 vi . spyOn ( process , 'once' ) . mockImplementation ( ( _e , cb ) => {
2523 exitCb = cb ;
2624 return process . on ( _e , cb ) ;
2725 } ) ;
28- stderrWriteMock = vi . spyOn ( process . stderr , 'write' ) . mockImplementation ( vi . fn ( ) ) ;
29- stdoutWriteMock = vi . spyOn ( process . stdout , 'write' ) . mockImplementation ( vi . fn ( ) ) ;
3026
3127 vi . mock ( '@redocly/openapi-core' ) ;
3228 vi . mocked ( bundle ) . mockImplementation (
@@ -209,7 +205,7 @@ describe('bundle', () => {
209205
210206 expect ( saveBundle ) . toBeCalledTimes ( 1 ) ;
211207 expect ( saveBundle ) . toHaveBeenCalledWith ( 'output/foo.yaml' , expect . any ( String ) ) ;
212- expect ( process . stdout . write ) . toHaveBeenCalledTimes ( 1 ) ;
208+ expect ( logger . output ) . toHaveBeenCalledTimes ( 1 ) ;
213209 } ) ;
214210
215211 it ( 'should NOT store bundled API descriptions in the output files described in the apis section of config IF there is a positional api provided' , async ( ) => {
@@ -241,7 +237,7 @@ describe('bundle', () => {
241237 } ) ;
242238
243239 expect ( saveBundle ) . toBeCalledTimes ( 0 ) ;
244- expect ( process . stdout . write ) . toHaveBeenCalledTimes ( 1 ) ;
240+ expect ( logger . output ) . toHaveBeenCalledTimes ( 1 ) ;
245241 } ) ;
246242
247243 it ( 'should store bundled API descriptions in the directory specified in argv IF multiple positional apis provided AND --output specified' , async ( ) => {
0 commit comments