76
76
jest . mock (
77
77
'test_preprocessor' ,
78
78
( ) => {
79
- const escapeStrings = ( str : string ) => str . replace ( / ' / , "'" ) ;
80
-
81
79
const transformer : Transformer = {
82
80
getCacheKey : jest . fn ( ( ) => 'ab' ) ,
83
81
process : ( content , filename , config ) => ( {
84
82
code : ( require ( 'dedent' ) as typeof import ( 'dedent' ) . default ) `
85
83
const TRANSFORMED = {
86
- filename: '${ escapeStrings ( filename ) } ',
87
- script: '${ escapeStrings ( content ) } ',
88
- config: '${ escapeStrings ( JSON . stringify ( config ) ) } ',
84
+ filename: '${ filename } ',
85
+ script: '${ content } ',
86
+ config: '${ JSON . stringify ( config ) } ',
89
87
};
90
88
` ,
91
89
} ) ,
@@ -99,17 +97,15 @@ jest.mock(
99
97
jest . mock (
100
98
'test_async_preprocessor' ,
101
99
( ) => {
102
- const escapeStrings = ( str : string ) => str . replace ( / ' / , "'" ) ;
103
-
104
100
const transformer : AsyncTransformer = {
105
101
getCacheKeyAsync : jest . fn ( ( ) => Promise . resolve ( 'ab' ) ) ,
106
102
processAsync : ( content , filename , config ) =>
107
103
Promise . resolve ( {
108
104
code : ( require ( 'dedent' ) as typeof import ( 'dedent' ) . default ) `
109
105
const TRANSFORMED = {
110
- filename: '${ escapeStrings ( filename ) } ',
111
- script: '${ escapeStrings ( content ) } ',
112
- config: '${ escapeStrings ( JSON . stringify ( config ) ) } ',
106
+ filename: '${ filename } ',
107
+ script: '${ content } ',
108
+ config: '${ JSON . stringify ( config ) } ',
113
109
};
114
110
` ,
115
111
} ) ,
0 commit comments