@@ -617,4 +617,45 @@ describe('source-map-loader', () => {
617617 expect ( getWarnings ( stats ) ) . toMatchSnapshot ( 'warnings' ) ;
618618 expect ( getErrors ( stats ) ) . toMatchSnapshot ( 'errors' ) ;
619619 } ) ;
620+
621+ it ( 'should process server-relative-url-path' , async ( ) => {
622+ const sourceRoot = path . resolve ( __dirname , 'fixtures' ) ;
623+ const javaScriptFilename = 'server-relative-url-path.js' ;
624+ const sourceFilename = 'server-relative-url-path.js' ;
625+ const sourceMapPath = path . join (
626+ sourceRoot ,
627+ 'server-relative-url-path.js.map'
628+ ) ;
629+
630+ // Create the sourcemap file
631+ const rawSourceMap = {
632+ version : 3 ,
633+ file : javaScriptFilename ,
634+ sourceRoot,
635+ sources : [ sourceFilename ] ,
636+ mappings : 'AAAA' ,
637+ } ;
638+ fs . writeFileSync ( sourceMapPath , JSON . stringify ( rawSourceMap ) ) ;
639+
640+ const testId = 'server-relative-url-path.js' ;
641+ const compiler = getCompiler ( testId ) ;
642+ const stats = await compile ( compiler ) ;
643+ const codeFromBundle = getCodeFromBundle ( stats , compiler ) ;
644+
645+ expect ( codeFromBundle . css ) . toMatchSnapshot ( 'css' ) ;
646+ expect ( normalizeMap ( codeFromBundle . map ) ) . toMatchSnapshot ( 'map' ) ;
647+ expect ( getWarnings ( stats ) ) . toMatchSnapshot ( 'warnings' ) ;
648+ expect ( getErrors ( stats ) ) . toMatchSnapshot ( 'errors' ) ;
649+ } ) ;
650+
651+ it ( 'should emit warning when unresolved server-relative-url-path' , async ( ) => {
652+ const testId = 'unresolved-server-relative-url-path.js' ;
653+ const compiler = getCompiler ( testId ) ;
654+ const stats = await compile ( compiler ) ;
655+ const codeFromBundle = getCodeFromBundle ( stats , compiler ) ;
656+
657+ expect ( codeFromBundle . css ) . toMatchSnapshot ( 'css' ) ;
658+ expect ( getWarnings ( stats , true ) ) . toMatchSnapshot ( 'warnings' ) ;
659+ expect ( getErrors ( stats ) ) . toMatchSnapshot ( 'errors' ) ;
660+ } ) ;
620661} ) ;
0 commit comments