Skip to content

Commit

Permalink
feat(coverage): second transformer build does not print typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Jun 6, 2024
1 parent 900bc42 commit df7d0a4
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 14 deletions.
3 changes: 1 addition & 2 deletions crates/oxc_codegen/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2405,8 +2405,7 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for MethodDefinition<'a> {
}
if let Some(body) = &self.value.body {
body.gen(p, ctx);
}
if p.options.enable_typescript {
} else if p.options.enable_typescript {
p.print_semicolon_after_statement();
}
}
Expand Down
25 changes: 15 additions & 10 deletions tasks/coverage/src/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn get_result(
)
.build(&mut program);

let source_text1 = Codegen::<false>::new(
let ts_source_text1 = Codegen::<false>::new(
&filename,
source_text,
CodegenOptions::default().with_typescript(true),
Expand All @@ -62,7 +62,16 @@ fn get_result(
.build(&program)
.source_text;

let parse_result2 = Parser::new(&allocator, &source_text1, source_type).parse();
let source_text1 =
Codegen::<false>::new(&filename, source_text, CodegenOptions::default(), None)
.build(&program)
.source_text;

if ts_source_text1 != source_text1 {
return TestResult::Mismatch(ts_source_text1.clone(), source_text1.clone());
}

let parse_result2 = Parser::new(&allocator, &ts_source_text1, source_type).parse();
let mut program = parse_result2.program;

let _ = Transformer::new(
Expand All @@ -75,14 +84,10 @@ fn get_result(
)
.build(&mut program);

let source_text2 = Codegen::<false>::new(
&filename,
&source_text1,
CodegenOptions::default().with_typescript(true),
None,
)
.build(&program)
.source_text;
let source_text2 =
Codegen::<false>::new(&filename, &source_text1, CodegenOptions::default(), None)
.build(&program)
.source_text;

let result = source_text1 == source_text2;

Expand Down
6 changes: 5 additions & 1 deletion tasks/coverage/transformer_babel.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ commit: 4bd1b2c2

transformer_babel Summary:
AST Parsed : 2099/2099 (100.00%)
Positive Passed: 2099/2099 (100.00%)
Positive Passed: 2095/2099 (99.81%)
Mismatch: "typescript/class/parameter-properties/input.ts"
Mismatch: "typescript/export/as-namespace/input.ts"
Mismatch: "typescript/export/equals/input.ts"
Mismatch: "typescript/export/equals-in-unambiguous/input.ts"
36 changes: 35 additions & 1 deletion tasks/coverage/transformer_typescript.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,39 @@ commit: 64d2eeea

transformer_typescript Summary:
AST Parsed : 5243/5243 (100.00%)
Positive Passed: 5242/5243 (99.98%)
Positive Passed: 5208/5243 (99.33%)
Mismatch: "compiler/amdModuleName1.ts"
Mismatch: "compiler/avoidCycleWithVoidExpressionReturnedFromArrow.ts"
Mismatch: "compiler/clinterfaces.ts"
Mismatch: "compiler/collectionPatternNoError.ts"
Mismatch: "compiler/comparabilityTypeParametersRelatedByUnion.ts"
Mismatch: "compiler/constEnumMergingWithValues1.ts"
Mismatch: "compiler/constEnumMergingWithValues2.ts"
Mismatch: "compiler/constEnumMergingWithValues3.ts"
Mismatch: "compiler/constEnumMergingWithValues4.ts"
Mismatch: "compiler/constEnumMergingWithValues5.ts"
Mismatch: "compiler/elidedEmbeddedStatementsReplacedWithSemicolon.ts"
Mismatch: "compiler/es5-umd4.ts"
Mismatch: "compiler/exportAssignValueAndType.ts"
Mismatch: "compiler/exportAssignmentError.ts"
Mismatch: "compiler/exportAssignmentWithImportStatementPrivacyError.ts"
Mismatch: "compiler/exportAssignmentWithPrivacyError.ts"
Mismatch: "compiler/exportAssignmentWithoutIdentifier1.ts"
Mismatch: "compiler/exportEqualNamespaces.ts"
Mismatch: "compiler/exportEqualsAmd.ts"
Mismatch: "compiler/exportEqualsClassNoRedeclarationError.ts"
Mismatch: "compiler/exportEqualsCommonJs.ts"
Mismatch: "compiler/exportEqualsUmd.ts"
Mismatch: "compiler/module_augmentUninstantiatedModule2.ts"
Mismatch: "compiler/noCircularDefinitionOnExportOfPrivateInMergedNamespace.ts"
Mismatch: "compiler/noErrorUsingImportExportModuleAugmentationInDeclarationFile1.ts"
Mismatch: "compiler/recursiveFieldSetting.ts"
Mismatch: "compiler/sourceMapValidationExportAssignment.ts"
Mismatch: "compiler/sourceMapValidationExportAssignmentCommonjs.ts"
Mismatch: "compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts"
Mismatch: "compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts"
Mismatch: "conformance/classes/members/privateNames/privateNameFieldParenthesisLeftAssignment.ts"
Mismatch: "conformance/classes/propertyMemberDeclarations/initializationOrdering1.ts"
Mismatch: "conformance/classes/propertyMemberDeclarations/instanceMemberInitialization.ts"
Mismatch: "conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter5.ts"
Mismatch: "conformance/statements/VariableStatements/usingDeclarations/usingDeclarationsTopLevelOfModule.2.ts"

0 comments on commit df7d0a4

Please sign in to comment.