File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -271,20 +271,20 @@ const generateUnformattedCode = (
271
271
const formatCode = ( code : string ) => {
272
272
// in test environment, window.api is not defined,
273
273
// so we reference original prettier format function instead
274
- // if (process.env.NODE_ENV === 'test') {
275
- // const { format } = require('prettier');
276
- // return format(code, {
277
- // singleQuote: true,
278
- // trailingComma: 'es5',
279
- // bracketSpacing: true,
280
- // jsxBracketSameLine: true,
281
- // parser: 'babel'
282
- // });
283
- // } else {
284
- // return window.api.formatCode(code);
285
- // }
274
+ if ( process . env . NODE_ENV === 'test' ) {
275
+ const { format } = require ( 'prettier' ) ;
276
+ return format ( code , {
277
+ singleQuote : true ,
278
+ trailingComma : 'es5' ,
279
+ bracketSpacing : true ,
280
+ jsxBracketSameLine : true ,
281
+ parser : 'babel'
282
+ } ) ;
283
+ } else if ( process . env . NODE_ENV === 'production' ) {
284
+ return window . api . formatCode ( code ) ;
285
+ } else {
286
286
return code ;
287
-
287
+ }
288
288
} ;
289
289
290
290
// generate code based on component hierarchy and then return the rendered code
You can’t perform that action at this time.
0 commit comments