@@ -4,16 +4,27 @@ import { format } from 'prettier';
44import { plugin } from './../../src/index' ;
55
66describe ( 'Interpolations' , ( ) => {
7+ const backupProcessEnv : Record < string , string | undefined > = process . env ;
8+
9+ afterEach ( ( ) => {
10+ process . env = { ...backupProcessEnv } ;
11+ } ) ;
12+
713 test ( 'should handle Neutral interpolations' , ( ) => {
814 const expected : string = readFileSync ( resolve ( __dirname , 'formatted_none.pug' ) , 'utf8' ) ;
915 const code : string = readFileSync ( resolve ( __dirname , 'unformatted_none.pug' ) , 'utf8' ) ;
1016 const actual : string = format ( code , { parser : 'pug' , plugins : [ plugin ] } ) ;
1117
1218 expect ( actual ) . toBe ( expected ) ;
1319 } ) ;
20+
1421 test ( 'should handle Angular interpolations' , ( ) => {
1522 const expected : string = readFileSync ( resolve ( __dirname , 'formatted_angular.pug' ) , 'utf8' ) ;
1623 const code : string = readFileSync ( resolve ( __dirname , 'unformatted_angular.pug' ) , 'utf8' ) ;
24+
25+ // process.env should be ignored
26+ process . env . npm_package_dependencies_vue = 'some version' ;
27+
1728 const actual : string = format ( code , {
1829 parser : 'pug' ,
1930 plugins : [ plugin ] ,
@@ -23,9 +34,14 @@ describe('Interpolations', () => {
2334
2435 expect ( actual ) . toBe ( expected ) ;
2536 } ) ;
37+
2638 test ( 'should handle Vue interpolations' , ( ) => {
2739 const expected : string = readFileSync ( resolve ( __dirname , 'formatted_vue.pug' ) , 'utf8' ) ;
2840 const code : string = readFileSync ( resolve ( __dirname , 'unformatted_vue.pug' ) , 'utf8' ) ;
41+
42+ // process.env should be ignored
43+ process . env . npm_package_devDependencies_svelte = 'some version' ;
44+
2945 const actual : string = format ( code , {
3046 parser : 'pug' ,
3147 plugins : [ plugin ] ,
0 commit comments