@@ -4,7 +4,6 @@ const { openMockFile, getFirstResponseOfType } = require('./_helpers');
44
55const mockFileName = 'main.ts' ;
66
7-
87describe ( 'Errors' , ( ) => {
98 it ( 'should return error for unknown property' , ( ) => {
109 const server = createServer ( ) ;
@@ -115,4 +114,44 @@ describe('Errors', () => {
115114 assert . strictEqual ( error . end . offset , 8 ) ;
116115 } ) ;
117116 } ) ;
117+
118+ it ( 'should not error with interpolation at start, followed by semicolon #22' , ( ) => {
119+ const server = createServer ( ) ;
120+
121+ const lines = [
122+ "function css(...args){}" ,
123+ "const mixin = ''" ,
124+
125+ // test single-line
126+ "css`${mixin}; color: blue;`" ,
127+
128+ // test multi-line (normal case)
129+ "css`" ,
130+ " ${mixin};" ,
131+ " color: blue;" ,
132+ "`" ,
133+
134+ // test multiple spaces after semi
135+ "css`" ,
136+ " ${mixin} ;" ,
137+ " color: blue;" ,
138+ "`" ,
139+
140+ // test hella semis - will this ever pop up? probably not, but screw it
141+ "css`" ,
142+ " ${mixin};;; ;; ;" ,
143+ " color: blue;" ,
144+ "`" ,
145+ ] ;
146+
147+ openMockFile ( server , mockFileName , lines . join ( '\n' ) ) ;
148+
149+ server . send ( { command : 'semanticDiagnosticsSync' , arguments : { file : mockFileName } } ) ;
150+
151+ return server . close ( ) . then ( ( ) => {
152+ const errorResponse = getFirstResponseOfType ( 'semanticDiagnosticsSync' , server ) ;
153+ assert . isTrue ( errorResponse . success ) ;
154+ assert . strictEqual ( errorResponse . body . length , 0 ) ;
155+ } ) ;
156+ } )
118157} )
0 commit comments