Skip to content

Commit

Permalink
test: add tests on {parser,generator}Override (#12740)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Feb 3, 2021
1 parent 887eb07 commit 7fb6048
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 0 deletions.
@@ -0,0 +1 @@
1;
@@ -0,0 +1,3 @@
{
"plugins": ["./plugin"]
}
@@ -0,0 +1 @@
0;
@@ -0,0 +1,9 @@
module.exports = function (api) {
return {
generatorOverride(ast, generatorOpts, code, generate) {
const result = generate(ast, generatorOpts, code);
result.code = result.code.replace("1", "0");
return result;
},
};
};
@@ -0,0 +1 @@
1;
@@ -0,0 +1,3 @@
{
"plugins": ["./plugin"]
}
@@ -0,0 +1 @@
0;
@@ -0,0 +1,9 @@
module.exports = function (api) {
return {
parserOverride(code, opts, parse) {
const ast = parse(code, opts);
ast.program.body[0].expression.value = 0;
return ast;
},
};
};

0 comments on commit 7fb6048

Please sign in to comment.