Skip to content

Commit 262549c

Browse files
committed
check helperFn
1 parent 3516d4c commit 262549c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/utils.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ const assertHelper = (options) => {
113113
const rewriter = new Synvert.Rewriter("group", "name", function () {
114114
this.configure({ parser: Synvert.Parser.TYPESCRIPT });
115115
this.withinFilesSync("*.{js,jsx}", function () {
116-
this.callHelperSync(options.helper, options.options, options.helperFn.bind(this));
116+
if (options.helperFn) {
117+
this.callHelperSync(options.helper, options.options, options.helperFn.bind(this));
118+
} else {
119+
this.callHelperSync(options.helper, options.options);
120+
}
117121
});
118122
});
119123
rewriter.processSync();
@@ -137,7 +141,11 @@ const assertHelper = (options) => {
137141
const rewriter = new Synvert.Rewriter("group", "name", async function () {
138142
this.configure({ parser: Synvert.Parser.TYPESCRIPT });
139143
await this.withinFiles("*.{js,jsx}", async function () {
140-
await this.callHelper(options.helper, options.options, options.helperFn.bind(this));
144+
if (options.helperFn) {
145+
await this.callHelper(options.helper, options.options, options.helperFn.bind(this));
146+
} else {
147+
await this.callHelper(options.helper, options.options);
148+
}
141149
});
142150
});
143151
await rewriter.process();

0 commit comments

Comments
 (0)