@@ -31,9 +31,9 @@ describe('Babel Root Import - Plugin', () => {
3131 } ) ;
3232
3333 it ( 'transforms for import() syntax' , ( ) => {
34- const targetRequire = slash ( `' ./some/example.js' ` ) ;
34+ const targetRequire = slash ( `" ./some/example.js" ` ) ;
3535 const transformed = babelTransform (
36- " var SomeExample = import(' ~/some/example.js');" ,
36+ ' var SomeExample = import(" ~/some/example.js");' ,
3737 {
3838 plugins : [ importSyntaxPlugin , BabelRootImportPlugin ] ,
3939 } ,
@@ -51,6 +51,18 @@ describe('Babel Root Import - Plugin', () => {
5151 expect ( transformed . code ) . to . contain ( targetRequire ) ;
5252 } ) ;
5353
54+ it ( 'transforms for require() with template literal' , ( ) => {
55+ const targetRequire = slash ( '`./some/${foo}`' ) ;
56+ const transformed = babelTransform (
57+ 'var SomeExample = require(`~/some/${foo}`);' ,
58+ {
59+ plugins : [ BabelRootImportPlugin ] ,
60+ } ,
61+ ) ;
62+
63+ expect ( transformed . code ) . to . contain ( targetRequire ) ;
64+ } ) ;
65+
5466 it ( 'transforms for custom functions' , ( ) => {
5567 const targetRequire = slash ( `/some/example.js` ) ;
5668 const transformed = babelTransform (
0 commit comments