File tree 4 files changed +15
-4
lines changed
packages/plugin-putout/lib/convert-report-to-function
4 files changed +15
-4
lines changed Original file line number Diff line number Diff line change
1
+ export const report = ( ) => 'hello' ;
Original file line number Diff line number Diff line change
1
+ export const report = 'hello' ;
Original file line number Diff line number Diff line change @@ -5,12 +5,16 @@ const {
5
5
isTemplateLiteral,
6
6
} = types ;
7
7
8
+ const check = ( { __a} ) => isStringLiteral ( __a ) || isTemplateLiteral ( __a ) ;
9
+
8
10
export const report = ( ) => `Typeof 'report' should be a 'function'` ;
9
11
10
12
export const match = ( ) => ( {
11
- 'module.exports.report = __a' : ( { __a} ) => isStringLiteral ( __a ) || isTemplateLiteral ( __a ) ,
13
+ 'module.exports.report = __a' : check ,
14
+ 'export const report = __a' : check ,
12
15
} ) ;
13
16
14
17
export const replace = ( ) => ( {
15
18
'module.exports.report = __a' : 'module.exports.report = () => __a' ,
19
+ 'export const report = __a' : 'export const report = () => __a' ,
16
20
} ) ;
Original file line number Diff line number Diff line change @@ -7,17 +7,22 @@ const test = createTest(import.meta.url, {
7
7
] ,
8
8
} ) ;
9
9
10
- test ( 'plugin-putout: convert report to function: report: convert-report-to-function' , ( t ) => {
10
+ test ( 'plugin-putout: convert- report-to- function: report: convert-report-to-function' , ( t ) => {
11
11
t . report ( 'convert-report-to-function' , `Typeof 'report' should be a 'function'` ) ;
12
12
t . end ( ) ;
13
13
} ) ;
14
14
15
- test ( 'plugin-putout: convert report to function: transform: convert-report-to-function' , ( t ) => {
15
+ test ( 'plugin-putout: convert- report-to- function: transform: convert-report-to-function' , ( t ) => {
16
16
t . transform ( 'convert-report-to-function' ) ;
17
17
t . end ( ) ;
18
18
} ) ;
19
19
20
- test ( 'plugin-putout: convert report to function: transform: template' , ( t ) => {
20
+ test ( 'plugin-putout: convert- report-to- function: transform: template' , ( t ) => {
21
21
t . transform ( 'template' ) ;
22
22
t . end ( ) ;
23
23
} ) ;
24
+
25
+ test ( 'plugin-putout: convert-report-to-function: transform: esm' , ( t ) => {
26
+ t . transform ( 'esm' ) ;
27
+ t . end ( ) ;
28
+ } ) ;
You can’t perform that action at this time.
0 commit comments