File tree Expand file tree Collapse file tree
test/configCases/parsing/top-level-this-global Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,12 +3,15 @@ require("./common");
33// built rather than written out, so the needle is not in the bundle it reads
44const globalThisAccess = [ "globalThis" , "fromEntry" ] . join ( "." ) ;
55const runtimeGlobalAccess = [ "__webpack_require__" , "g" , "fromEntry" ] . join ( "." ) ;
6+ const runtimeGlobalDefinition = [ "__webpack_require__" , "g = " ] . join ( "." ) ;
67
78it ( "should spell the global object as globalThis" , ( ) => {
89 const source = require ( "fs" ) . readFileSync ( __filename , "utf8" ) ;
910
1011 expect ( source ) . toContain ( globalThisAccess ) ;
1112 expect ( source ) . not . toContain ( runtimeGlobalAccess ) ;
13+ // a target that has the binding pays for no runtime module either
14+ expect ( source ) . not . toContain ( runtimeGlobalDefinition ) ;
1215} ) ;
1316
1417this . fromEntry = "entry" ;
Original file line number Diff line number Diff line change @@ -3,12 +3,15 @@ require("./common");
33// built rather than written out, so the needle is not in the bundle it reads
44const globalThisAccess = [ "globalThis" , "fromEntry" ] . join ( "." ) ;
55const runtimeGlobalAccess = [ "__webpack_require__" , "g" , "fromEntry" ] . join ( "." ) ;
6+ const runtimeGlobalDefinition = [ "__webpack_require__" , "g = " ] . join ( "." ) ;
67
78it ( "should spell the global object as __webpack_require__.g" , ( ) => {
89 const source = require ( "fs" ) . readFileSync ( __filename , "utf8" ) ;
910
1011 expect ( source ) . toContain ( runtimeGlobalAccess ) ;
1112 expect ( source ) . not . toContain ( globalThisAccess ) ;
13+ // and one that does not carries the polyfill
14+ expect ( source ) . toContain ( runtimeGlobalDefinition ) ;
1215} ) ;
1316
1417this . fromEntry = "entry" ;
You can’t perform that action at this time.
0 commit comments