@@ -4,7 +4,7 @@ import process from 'node:process';
44import { describe , expect , it , vi } from 'vitest' ;
55import { formatCommandStatus } from './command.js' ;
66
7- describe ( 'formatCommand ' , ( ) => {
7+ describe ( 'formatCommandStatus ' , ( ) => {
88 it ( 'should format complex command with cwd, env, and status' , ( ) => {
99 expect (
1010 formatCommandStatus (
@@ -32,12 +32,17 @@ describe('formatCommand', () => {
3232 } ) ;
3333
3434 it ( 'should not include cwd prefix when cwd is same as process.cwd()' , ( ) => {
35- vi . spyOn ( path , 'relative' ) . mockReturnValue ( '' ) ;
3635 expect ( formatCommandStatus ( 'npx -v' , { cwd : process . cwd ( ) } ) ) . toStartWith (
3736 `${ ansis . blue ( '$' ) } ` ,
3837 ) ;
3938 } ) ;
4039
40+ it ( 'should include cwd prefix when cwd is provided and different from process.cwd()' , ( ) => {
41+ expect (
42+ formatCommandStatus ( 'npx -v' , { cwd : path . join ( process . cwd ( ) , 'src' ) } ) ,
43+ ) . toStartWith ( `${ ansis . blue ( 'src' ) } ` ) ;
44+ } ) ;
45+
4146 it ( 'should format command with multiple environment variables' , ( ) => {
4247 const result = formatCommandStatus ( 'npx eslint .' , {
4348 env : { NODE_ENV : 'test' , NODE_OPTIONS : '--import tsx' } ,
0 commit comments