88 getDoctorConfigInputForTest ,
99 runDoctorConfigWithInput ,
1010} from "./doctor-config-flow.test-utils.js" ;
11+ import { runDoctorConfigPreflight } from "./doctor-config-preflight.js" ;
1112
1213type TerminalNote = ( message : string , title ?: string ) => void ;
1314
@@ -1509,6 +1510,7 @@ describe("doctor config flow", () => {
15091510 callGatewayMock . mockReset ( ) ;
15101511 callGatewayMock . mockResolvedValue ( { } ) ;
15111512 runDoctorRepairSequenceMock . mockReset ( ) ;
1513+ vi . mocked ( runDoctorConfigPreflight ) . mockClear ( ) ;
15121514 collectDoctorPreviewNotesParamsMock . mockClear ( ) ;
15131515 collectImplicitFallbackClobberWarningsMock . mockClear ( ) ;
15141516 collectImplicitFallbackClobberWarningsMock . mockReturnValue ( [ ] ) ;
@@ -1529,6 +1531,63 @@ describe("doctor config flow", () => {
15291531 } ) ;
15301532 } ) ;
15311533
1534+ it ( "does not run state or legacy config migrations for dry-run previews" , async ( ) => {
1535+ await runDoctorConfigWithInput ( {
1536+ config : { } ,
1537+ run : ( { confirm } ) =>
1538+ loadAndMaybeMigrateDoctorConfig ( {
1539+ options : { nonInteractive : true , dryRun : true } ,
1540+ confirm : async ( ) => confirm ( ) ,
1541+ } ) ,
1542+ } ) ;
1543+
1544+ expect ( runDoctorConfigPreflight ) . toHaveBeenCalledWith (
1545+ expect . objectContaining ( {
1546+ migrateState : false ,
1547+ migrateLegacyConfig : false ,
1548+ repairPrefixedConfig : false ,
1549+ recoverCorruptTargetStore : false ,
1550+ } ) ,
1551+ ) ;
1552+ } ) ;
1553+
1554+ it ( "does not run state or legacy config migrations for diff previews" , async ( ) => {
1555+ await runDoctorConfigWithInput ( {
1556+ config : { } ,
1557+ run : ( { confirm } ) =>
1558+ loadAndMaybeMigrateDoctorConfig ( {
1559+ options : { nonInteractive : true , diff : true } ,
1560+ confirm : async ( ) => confirm ( ) ,
1561+ } ) ,
1562+ } ) ;
1563+
1564+ expect ( runDoctorConfigPreflight ) . toHaveBeenCalledWith (
1565+ expect . objectContaining ( {
1566+ migrateState : false ,
1567+ migrateLegacyConfig : false ,
1568+ repairPrefixedConfig : false ,
1569+ recoverCorruptTargetStore : false ,
1570+ } ) ,
1571+ ) ;
1572+ } ) ;
1573+
1574+ it ( "keeps migrations enabled for repair runs" , async ( ) => {
1575+ await runDoctorConfigWithInput ( {
1576+ config : { } ,
1577+ repair : true ,
1578+ run : loadAndMaybeMigrateDoctorConfig ,
1579+ } ) ;
1580+
1581+ expect ( runDoctorConfigPreflight ) . toHaveBeenCalledWith (
1582+ expect . objectContaining ( {
1583+ migrateState : true ,
1584+ migrateLegacyConfig : true ,
1585+ repairPrefixedConfig : true ,
1586+ recoverCorruptTargetStore : true ,
1587+ } ) ,
1588+ ) ;
1589+ } ) ;
1590+
15321591 it ( "collects plugin blocker previews from the pre-auto-enable config" , async ( ) => {
15331592 await runDoctorConfigWithInput ( {
15341593 config : {
0 commit comments