File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ class ExternalModule extends Module {
120120 updateHash ( hash ) {
121121 hash . update ( this . type ) ;
122122 hash . update ( JSON . stringify ( this . request ) ) ;
123- hash . update ( JSON . stringify ( this . optional ) ) ;
123+ hash . update ( JSON . stringify ( Boolean ( this . optional ) ) ) ;
124124 super . updateHash ( hash ) ;
125125 }
126126}
Original file line number Diff line number Diff line change @@ -340,4 +340,32 @@ module.exports = some/request;`;
340340 hashedText . should . containEql ( "12345678" ) ;
341341 } ) ;
342342 } ) ;
343+
344+ describe ( "#updateHash without optional" , function ( ) {
345+ let hashedText ;
346+ let hash ;
347+ beforeEach ( function ( ) {
348+ hashedText = "" ;
349+ hash = {
350+ update : ( text ) => {
351+ hashedText += text ;
352+ }
353+ } ;
354+ // Note no set of `externalModule.optional`, which crashed externals in 3.7.0
355+ externalModule . id = 12345678 ;
356+ externalModule . updateHash ( hash ) ;
357+ } ) ;
358+ it ( "updates hash with request" , function ( ) {
359+ hashedText . should . containEql ( "some/request" ) ;
360+ } ) ;
361+ it ( "updates hash with type" , function ( ) {
362+ hashedText . should . containEql ( "some-type" ) ;
363+ } ) ;
364+ it ( "updates hash with optional flag" , function ( ) {
365+ hashedText . should . containEql ( "false" ) ;
366+ } ) ;
367+ it ( "updates hash with module id" , function ( ) {
368+ hashedText . should . containEql ( "12345678" ) ;
369+ } ) ;
370+ } ) ;
343371} ) ;
You can’t perform that action at this time.
0 commit comments