File tree Expand file tree Collapse file tree
packages/jest-haste-map/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -586,7 +586,7 @@ describe('HasteMap', () => {
586586 } ) ;
587587 } ) ;
588588
589- it ( 'correctly handles platform-specific file deletions (broken) ' , async ( ) => {
589+ it ( 'correctly handles platform-specific file deletions' , async ( ) => {
590590 mockFs = Object . create ( null ) ;
591591 mockFs [ '/fruits/strawberry.js' ] = [
592592 '/**' ,
@@ -613,8 +613,6 @@ describe('HasteMap', () => {
613613 ( { __hasteMapForTest : data } = await new HasteMap ( defaultConfig ) . build ( ) ) ;
614614 expect ( data . map [ 'Strawberry' ] ) . toEqual ( {
615615 g : [ '/fruits/strawberry.js' , 0 ] ,
616- // FIXME: this file should NOT exist anymore!
617- ios : [ '/fruits/strawberry.ios.js' , 0 ] ,
618616 } ) ;
619617 } ) ;
620618
Original file line number Diff line number Diff line change @@ -422,8 +422,18 @@ class HasteMap extends EventEmitter {
422422 if ( fileMetadata [ H . VISITED ] ) {
423423 if ( ! fileMetadata [ H . ID ] ) {
424424 return null ;
425- } else if ( fileMetadata [ H . ID ] && moduleMetadata ) {
426- map [ fileMetadata [ H . ID ] ] = moduleMetadata ;
425+ }
426+ if ( moduleMetadata != null ) {
427+ const platform =
428+ getPlatformExtension ( filePath , this . _options . platforms ) ||
429+ H . GENERIC_PLATFORM ;
430+ const module = moduleMetadata [ platform ] ;
431+ if ( module == null ) {
432+ return null ;
433+ }
434+ const modulesByPlatform = map [ fileMetadata [ H . ID ] ] ||
435+ ( map [ fileMetadata [ H . ID ] ] = { } ) ;
436+ modulesByPlatform [ platform ] = module ;
427437 return null ;
428438 }
429439 }
You can’t perform that action at this time.
0 commit comments