We study the stability of mean-motion resonances ( MMR ) between two planets during their migration in a protoplanetary disk . We use an analytical model of resonances , and describe the effect of the disk by a migration timescale ( T _ { m,i } ) and an eccentricity damping timescale ( T _ { e,i } ) for each planet ( i = 1 , 2 respectively for the inner and outer planet ) . We show that the resonant configuration is stable if T _ { e, 1 } / T _ { e, 2 } > ( e _ { 1 } / e _ { 2 } ) ^ { 2 } . This general result can be used to put constraints on specific models of disk-planet interactions . For instance , using classical prescriptions for type I migration , we show that when the angular momentum deficit ( AMD ) of the inner orbit is larger than the outer ’ s orbit AMD , resonant systems must have a locally inverted disk density profile to stay locked in resonance during the migration . This inversion is very untypical of type I migration and our criterion can thus provide an evidence against classical type I migration . That is indeed the case for the Jupiter-mass resonant systems HD~60532 b , c ( 3:1 MMR ) , GJ~876 b , c ( 2:1 MMR ) , and HD~45364 b , c ( 3:2 MMR ) . This result may be an evidence for type II migration ( gap opening planets ) , which is compatible with the large masses of these planets .