Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tasks/transform-conformance) when the output file does not exist, the output content should be empty #2808

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions tasks/transform_conformance/babel.snap.md
@@ -1,7 +1,6 @@
Passed: 352/1369
Passed: 351/1369

# All Passed:
* babel-plugin-transform-numeric-separator
* babel-plugin-transform-optional-catch-binding
* babel-plugin-transform-json-strings
* babel-plugin-transform-shorthand-properties
Expand Down Expand Up @@ -515,6 +514,9 @@ Passed: 352/1369
# babel-plugin-transform-logical-assignment-operators (5/6)
* logical-assignment/null-coalescing/input.js

# babel-plugin-transform-numeric-separator (1/2)
* used-with-transform-es2015-literals/input.js

# babel-plugin-transform-export-namespace-from (0/4)
* export-namespace/namespace-default/input.mjs
* export-namespace/namespace-es6/input.mjs
Expand Down
9 changes: 3 additions & 6 deletions tasks/transform_conformance/src/test_case.rs
Expand Up @@ -268,11 +268,7 @@ impl TestCase for ConformanceTestCase {
if let Some(throws) = &babel_options.throws {
return throws.to_string();
}
// The transformation should be equal to input.js If output.js does not exist.
let program = Parser::new(&allocator, &input, source_type).parse().program;
Codegen::<false>::new("", &input, codegen_options.clone())
.build(&program)
.source_text
String::default()
Boshen marked this conversation as resolved.
Show resolved Hide resolved
},
|output| {
// Get expected code by parsing the source text, so we can get the same code generated result.
Expand All @@ -283,7 +279,8 @@ impl TestCase for ConformanceTestCase {
},
);

let passed = transformed_code == output || actual_errors.contains(&output);
let passed =
transformed_code == output || (!output.is_empty() && actual_errors.contains(&output));
if filtered {
println!("Input:\n");
println!("{input}\n");
Expand Down