@@ -68,23 +68,40 @@ describe('external files', () => {
6868 expect ( markup . code ) . toContain ( getFixtureContent ( 'template.html' ) ) ;
6969 } ) ;
7070
71+ it ( "warns if local file don't exist" , async ( ) => {
72+ const input = `<style src="./missing-potato"></style>` ;
73+
74+ await preprocess ( input , sveltePreprocess ( ) ) ;
75+
76+ expect ( warnSpy ) . toHaveBeenCalledWith (
77+ expect . stringContaining ( 'was not found' ) ,
78+ ) ;
79+ } ) ;
80+
7181 REMOTE_JS . forEach ( ( url ) => {
72- it ( `should not attempt to locally resolve ${ url } ` , async ( ) => {
82+ it ( `ignores remote path " ${ url } " ` , async ( ) => {
7383 const input = `<div></div><script src="${ url } "></script>` ;
7484
7585 const preprocessed = await preprocess ( input , sveltePreprocess ( ) ) ;
7686
7787 expect ( preprocessed . toString ?.( ) ) . toContain ( input ) ;
7888 expect ( preprocessed . dependencies ) . toHaveLength ( 0 ) ;
89+ expect ( warnSpy ) . not . toHaveBeenCalledWith (
90+ expect . stringContaining ( 'was not found' ) ,
91+ ) ;
7992 } ) ;
8093 } ) ;
8194
82- it ( "should warn if local file don't exist" , async ( ) => {
83- const input = `<style src="./missing -potato"></style>` ;
95+ it ( 'ignores external source if path is not relative' , async ( ) => {
96+ const input = `<style src="/root -potato"></style>` ;
8497
8598 await preprocess ( input , sveltePreprocess ( ) ) ;
8699
87- expect ( warnSpy ) . toHaveBeenCalledWith (
100+ const preprocessed = await preprocess ( input , sveltePreprocess ( ) ) ;
101+
102+ expect ( preprocessed . toString ?.( ) ) . toContain ( input ) ;
103+ expect ( preprocessed . dependencies ) . toHaveLength ( 0 ) ;
104+ expect ( warnSpy ) . not . toHaveBeenCalledWith (
88105 expect . stringContaining ( 'was not found' ) ,
89106 ) ;
90107 } ) ;
0 commit comments