File tree Expand file tree Collapse file tree
test/configCases/source-map
default-source-map-properties
eval-default-source-map-properties Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ it ( "should not include empty ignoreList in source map" , ( ) => {
2+ const fs = require ( "fs" ) ;
3+ const path = require ( "path" ) ;
4+ const sourceMapPath = path . join ( __dirname , "bundle0.js.map" ) ;
5+ const sourceMapContent = fs . readFileSync ( sourceMapPath , "utf-8" ) ;
6+
7+ expect ( sourceMapContent ) . not . toMatch ( / " i g n o r e L i s t " \s * : \s * \[ \s * \] / ) ;
8+
9+ // Verify default source map properties are present
10+ const sourceMap = JSON . parse ( sourceMapContent ) ;
11+ expect ( sourceMap ) . toHaveProperty ( "version" , 3 ) ;
12+ expect ( sourceMap ) . toHaveProperty ( "sources" ) ;
13+ expect ( Array . isArray ( sourceMap . sources ) ) . toBe ( true ) ;
14+ expect ( sourceMap . sources . length ) . toBeGreaterThan ( 0 ) ;
15+ } ) ;
16+
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ /** @type {import("../../../../").Configuration } */
4+ module . exports = {
5+ mode : "development" ,
6+ devtool : "source-map" ,
7+ entry : "./index.js"
8+ } ;
Original file line number Diff line number Diff line change 1+ it ( "should not include empty ignoreList in eval source map" , ( ) => {
2+ const fs = require ( "fs" ) ;
3+ const source = fs . readFileSync ( __filename , "utf-8" ) ;
4+
5+ const match = / s o u r c e M a p p i n g U R L \s * = \s * d a t a : a p p l i c a t i o n \/ j s o n ; c h a r s e t = u t f - 8 ; b a s e 6 4 , ( [ A - Z a - z 0 - 9 + \/ = ] + ) / . exec (
6+ source
7+ ) ;
8+ expect ( match ) . not . toBeNull ( ) ;
9+ const mapString = Buffer . from ( match [ 1 ] , "base64" ) . toString ( "utf-8" ) ;
10+
11+ expect ( mapString ) . not . toMatch ( / " i g n o r e L i s t " \s * : \s * \[ \s * \] / ) ;
12+
13+ // Verify default source map properties are present
14+ const sourceMap = JSON . parse ( mapString ) ;
15+ expect ( sourceMap ) . toHaveProperty ( "version" , 3 ) ;
16+ expect ( sourceMap ) . toHaveProperty ( "sources" ) ;
17+ expect ( Array . isArray ( sourceMap . sources ) ) . toBe ( true ) ;
18+ expect ( sourceMap . sources . length ) . toBeGreaterThan ( 0 ) ;
19+ } ) ;
20+
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ /** @type {import("../../../../").Configuration } */
4+ module . exports = {
5+ mode : "development" ,
6+ devtool : "eval-source-map" ,
7+ entry : "./index.js"
8+ } ;
You can’t perform that action at this time.
0 commit comments