File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 1010- ` [expect] ` Stop modifying the sample in ` expect.objectContaining() ` ([ #10711 ] ( https://github.com/facebook/jest/pull/10711 ) )
1111- ` [jest-circus, jest-jasmine2] ` fix: don't assume ` stack ` is always a string ([ #10697 ] ( https://github.com/facebook/jest/pull/10697 ) )
1212- ` [jest-config] ` Fix bug introduced in watch mode by PR [ #10678 ] ( https://github.com/facebook/jest/pull/10678/files#r511037803 ) ([ #10692 ] ( https://github.com/facebook/jest/pull/10692 ) )
13+ - ` [jest-config] ` Throw correct error for missing preset modules ([ #10737 ] ( https://github.com/facebook/jest/pull/10737 ) )
1314- ` [jest-resolve-dependencies] ` Resolve mocks as dependencies ([ #10713 ] ( https://github.com/facebook/jest/pull/10713 ) )
1415- ` [jest-runtime] ` Handle file URLs in dynamic imports ([ #10744 ] ( https://github.com/facebook/jest/pull/10744 ) )
1516
Original file line number Diff line number Diff line change @@ -954,7 +954,7 @@ describe('preset', () => {
954954 return '/node_modules/react-native-js-preset/jest-preset.js' ;
955955 }
956956
957- if ( name === 'doesnt-exist' ) {
957+ if ( name . includes ( 'doesnt-exist' ) ) {
958958 return null ;
959959 }
960960
Original file line number Diff line number Diff line change @@ -133,14 +133,15 @@ const setupPreset = (
133133 ) ;
134134
135135 try {
136+ if ( ! presetModule ) {
137+ throw new Error ( `Cannot find module '${ presetPath } '` ) ;
138+ }
139+
136140 // Force re-evaluation to support multiple projects
137141 try {
138- if ( presetModule ) {
139- delete require . cache [ require . resolve ( presetModule ) ] ;
140- }
142+ delete require . cache [ require . resolve ( presetModule ) ] ;
141143 } catch { }
142144
143- // @ts -expect-error: `presetModule` can be null?
144145 preset = require ( presetModule ) ;
145146 } catch ( error ) {
146147 if ( error instanceof SyntaxError || error instanceof TypeError ) {
You can’t perform that action at this time.
0 commit comments