@@ -147,6 +147,24 @@ describe('ESM', () => {
147147 vanillaFileScope.endFileScope();
148148 ` ) ;
149149 } ) ;
150+
151+ test ( 'should preserve non-template strings that contain newline characters' , ( ) => {
152+ const source = `export const multiLineString = "\\nfoo\\n";` ;
153+
154+ expect (
155+ addFileScope ( {
156+ source,
157+ rootPath : '/the-root' ,
158+ filePath : '/the-root/app/app.css.ts' ,
159+ packageName : 'my-package' ,
160+ } ) ,
161+ ) . toMatchInlineSnapshot ( `
162+ import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
163+ setFileScope("app/app.css.ts", "my-package");
164+ export const multiLineString = "\\nfoo\\n";
165+ endFileScope();
166+ ` ) ;
167+ } ) ;
150168} ) ;
151169
152170describe ( 'CJS' , ( ) => {
@@ -266,6 +284,24 @@ describe('CJS', () => {
266284 __vanilla_filescope__.endFileScope();
267285 ` ) ;
268286 } ) ;
287+
288+ test ( 'should preserve non-template strings that contain newline characters' , ( ) => {
289+ const source = `exports.multiLineString = "\\nfoo\\n";` ;
290+
291+ expect (
292+ addFileScope ( {
293+ source,
294+ rootPath : '/the-root' ,
295+ filePath : '/the-root/app/app.css.ts' ,
296+ packageName : 'my-package' ,
297+ } ) ,
298+ ) . toMatchInlineSnapshot ( `
299+ const __vanilla_filescope__ = require("@vanilla-extract/css/fileScope");
300+ __vanilla_filescope__.setFileScope("app/app.css.ts", "my-package");
301+ exports.multiLineString = "\\nfoo\\n";
302+ __vanilla_filescope__.endFileScope();
303+ ` ) ;
304+ } ) ;
269305} ) ;
270306
271307test ( 'platform-specific relative path' , ( ) => {
0 commit comments