@@ -12,6 +12,7 @@ import inlineWebWorkerConfig from './cases/inline-web-worker/webpack.config';
1212import ignoreScriptsConfig from './cases/ignore-scripts/webpack.config' ;
1313import ignoreHtmlsConfig from './cases/ignore-htmls/webpack.config' ;
1414import ignoreScriptsAndHtmlsConfig from './cases/ignore-scripts-and-htmls/webpack.config' ;
15+ import filenameWithSpecialCharactersConfig from './cases/filename-with-special-characters/webpack.config' ;
1516
1617describe ( 'HtmlInlineScriptPlugin' , ( ) => {
1718 it ( 'should build simple webpack config without error' , async ( ) => {
@@ -202,6 +203,38 @@ describe('HtmlInlineScriptPlugin', () => {
202203 await webpackPromise ;
203204 } ) ;
204205
206+ it ( 'should inline filename with spacial characters without error' , async ( ) => {
207+ const webpackPromise = new Promise ( ( resolve ) => {
208+ const compiler = webpack ( filenameWithSpecialCharactersConfig ) ;
209+
210+ compiler . run ( ( error , stats ) => {
211+ expect ( error ) . toBeNull ( ) ;
212+
213+ const statsErrors = stats ?. compilation . errors ;
214+ expect ( statsErrors ?. length ) . toBe ( 0 ) ;
215+
216+ const result = fs . readFileSync (
217+ path . join ( __dirname , 'cases/filename-with-special-characters/dist/index.html' ) ,
218+ 'utf8' ,
219+ ) ;
220+
221+ const expected = fs . readFileSync (
222+ path . join ( __dirname , 'cases/filename-with-special-characters/expected/index.html' ) ,
223+ 'utf8' ,
224+ ) ;
225+ expect ( result ) . toBe ( expected ) ;
226+
227+ const expectedFileList = fs . readdirSync ( path . join ( __dirname , 'cases/filename-with-special-characters/expected/' ) ) ;
228+ const generatedFileList = fs . readdirSync ( path . join ( __dirname , 'cases/filename-with-special-characters/dist/' ) ) ;
229+ expect ( expectedFileList . sort ( ) ) . toEqual ( generatedFileList . sort ( ) ) ;
230+
231+ resolve ( true ) ;
232+ } ) ;
233+ } ) ;
234+
235+ await webpackPromise ;
236+ } ) ;
237+
205238 it ( 'should respect plugin options on script matching pattern' , async ( ) => {
206239 const webpackPromise = new Promise ( ( resolve ) => {
207240 const compiler = webpack ( ignoreScriptsConfig ) ;
0 commit comments