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

feat(transform_conformance): skip plugins we don't support yet #2967

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions crates/oxc_transformer/src/react/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn default_for_pragma_frag() -> Cow<'static, str> {
}

#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(default, rename_all = "camelCase")]
pub struct ReactOptions {
#[serde(skip)]
pub jsx_plugin: bool,
Expand Down Expand Up @@ -79,8 +79,16 @@ pub struct ReactOptions {
/// Defaults to `React.Fragment`.
#[serde(default = "default_for_pragma_frag")]
pub pragma_frag: Cow<'static, str>,
//
// `useBuiltIns` and `useSpread` are deprecated in babel 8.

/// `useBuiltIns` is deprecated in Babel 8.
///
/// This value is used to skip Babel tests, and is not used in oxc.
pub use_built_ins: Option<bool>,

/// `useSpread` is deprecated in Babel 8.
///
/// This value is used to skip Babel tests, and is not used in oxc.
pub use_spread: Option<bool>,
}

impl Default for ReactOptions {
Expand All @@ -96,6 +104,8 @@ impl Default for ReactOptions {
import_source: default_for_import_source(),
pragma: default_for_pragma(),
pragma_frag: default_for_pragma_frag(),
use_built_ins: None,
use_spread: None,
}
}
}
Expand Down
42 changes: 26 additions & 16 deletions tasks/transform_conformance/babel.snap.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Passed: 178/392
Passed: 191/415

# All Passed:
* babel-plugin-transform-react-jsx-source


# babel-preset-typescript (4/22)
# babel-preset-typescript (4/23)
* flow-compat/js-invalid/input.js
* flow-compat/js-valid/input.js
* flow-compat/ts-invalid/input.ts
Expand All @@ -13,6 +13,7 @@ Passed: 178/392
* flow-compat/tsx-valid/input.tsx
* jsx-compat/js-valid/input.js
* jsx-compat/ts-invalid/input.ts
* jsx-compat/ts-invalid-babel-7/input.ts
* jsx-compat/tsx-valid/input.tsx
* node-extensions/import-in-cts/input.cts
* node-extensions/type-assertion-in-cts/input.cts
Expand All @@ -24,13 +25,16 @@ Passed: 178/392
* opts/optimizeConstEnums/input.ts
* opts/rewriteImportExtensions/input.ts

# babel-plugin-transform-typescript (59/158)
# babel-plugin-transform-typescript (68/168)
* class/abstract-class-decorated/input.ts
* class/abstract-class-decorated-method/input.ts
* class/abstract-class-decorated-parameter/input.ts
* class/accessor-allowDeclareFields-false/input.ts
* class/accessor-allowDeclareFields-true/input.ts
* class/accessor-allowDeclareFields-true-babel-7/input.ts
* class/declare-not-enabled-babel-7/input.ts
* class/decorated-declare-properties/input.ts
* class/field-not-initialized-babel-7/input.ts
* class/parameter-properties/input.ts
* class/parameter-properties-late-super/input.ts
* class/parameter-properties-with-class/input.ts
Expand All @@ -39,6 +43,7 @@ Passed: 178/392
* class/parameter-properties-with-super/input.ts
* class/private-method-override-transform-private/input.ts
* class/transform-properties-declare-wrong-order/input.ts
* class/uninitialized-definite-with-declare-disabled-babel-7/input.ts
* declarations/erased/input.ts
* declarations/export-declare-enum/input.ts
* declarations/nested-namespace/input.mjs
Expand All @@ -50,7 +55,6 @@ Passed: 178/392
* exports/export-type-from/input.ts
* exports/export-type-star-from/input.ts
* exports/export=/input.ts
* exports/export=-to-cjs/input.ts
* exports/imported-types/input.ts
* exports/imported-types-only-remove-type-imports/input.ts
* exports/issue-9916-3/input.ts
Expand All @@ -76,7 +80,6 @@ Passed: 178/392
* imports/import-type-not-removed/input.ts
* imports/import=-declaration/input.ts
* imports/import=-module/input.ts
* imports/import=-module-to-cjs/input.ts
* imports/parameter-decorators/input.ts
* imports/property-signature/input.ts
* imports/type-only-export-specifier-1/input.ts
Expand Down Expand Up @@ -121,25 +124,24 @@ Passed: 178/392
* optimize-const-enums/merged-exported/input.ts
* regression/10162/input.ts
* regression/10338/input.ts
* regression/11061/input.mjs
* regression/15768/input.ts
* variable-declaration/non-null-in-optional-chain/input.ts

# babel-preset-react (2/13)
# babel-preset-react (2/14)
* preset-options/development/input.js
* preset-options/development-runtime-automatic/input.js
* preset-options/development-runtime-automatic-windows/input.js
* preset-options/development-windows/input.js
* preset-options/empty-options/input.js
* preset-options/empty-options-babel-7/input.js
* preset-options/runtime-automatic/input.js
* preset-options/runtime-classic/input.js
* preset-options/runtime-classic-pragma-no-frag/input.js
* regression/11294/input.mjs
* regression/another-preset-with-custom-jsx-keep-source-self/input.mjs
* regression/runtime-classic-allow-multiple-source-self/input.mjs

# babel-plugin-transform-react-jsx (96/156)
* autoImport/after-polyfills-compiled-to-cjs/input.mjs
# babel-plugin-transform-react-jsx (100/163)
* autoImport/auto-import-react-source-type-module/input.js
* autoImport/complicated-scope-module/input.js
* autoImport/import-source-pragma/input.js
Expand All @@ -153,7 +155,12 @@ Passed: 178/392
* pure/unset-pragma-comment-automatic-runtime/input.js
* pure/unset-pragma-comment-classic-runtime/input.js
* pure/unset-pragma-option-automatic-runtime/input.js
* react/adds-appropriate-newlines-when-using-spread-attribute-babel-7/input.js
* react/arrow-functions/input.js
* react/assignment-babel-7/input.js
* react/avoids-spread-babel-7/input.js
* react/does-not-add-source-self-babel-7/input.mjs
* react/handle-spread-with-proto-babel-7/input.js
* react/honor-custom-jsx-comment/input.js
* react/honor-custom-jsx-comment-if-jsx-pragma-option-set/input.js
* react/optimisation.react.constant-elements/input.js
Expand All @@ -168,6 +175,9 @@ Passed: 178/392
* react/should-throw-error-namespaces-if-not-flag/input.js
* react/should-warn-when-importSource-is-set/input.js
* react/should-warn-when-importSource-pragma-is-set/input.js
* react/wraps-props-in-react-spread-for-first-spread-attributes-babel-7/input.js
* react/wraps-props-in-react-spread-for-last-spread-attributes-babel-7/input.js
* react/wraps-props-in-react-spread-for-middle-spread-attributes-babel-7/input.js
* react-automatic/arrow-functions/input.js
* react-automatic/concatenates-adjacent-string-literals/input.js
* react-automatic/does-not-add-source-self-automatic/input.mjs
Expand All @@ -182,6 +192,7 @@ Passed: 178/392
* react-automatic/should-disallow-valueless-key/input.js
* react-automatic/should-disallow-xml-namespacing/input.js
* react-automatic/should-escape-xhtml-jsxtext/input.js
* react-automatic/should-escape-xhtml-jsxtext-babel-7/input.js
* react-automatic/should-handle-attributed-elements/input.js
* react-automatic/should-have-correct-comma-in-nested-children/input.js
* react-automatic/should-properly-handle-keys/input.js
Expand All @@ -191,14 +202,9 @@ Passed: 178/392
* regression/issue-12478-automatic/input.js
* regression/issue-12478-classic/input.js
* regression/pragma-frag-set-default-classic-runtime/input.js
* removed-options/invalid-use-builtins-false/input.js
* removed-options/invalid-use-builtins-true/input.js
* removed-options/invalid-use-spread-false/input.js
* removed-options/invalid-use-spread-true/input.js
* runtime/defaults-to-classis-babel-7/input.js
* runtime/invalid-runtime/input.js
* runtime/pragma-runtime-classsic/input.js
* spread-transform/transform-to-babel-extend/input.js
* spread-transform/transform-to-object-assign/input.js

# babel-plugin-transform-react-display-name (15/16)
* display-name/nested/input.js
Expand All @@ -207,12 +213,13 @@ Passed: 178/392
* react-source/arrow-function/input.js
* react-source/disable-with-super/input.js

# babel-plugin-transform-react-jsx-development (0/23)
# babel-plugin-transform-react-jsx-development (0/27)
* cross-platform/disallow-__self-as-jsx-attribute/input.js
* cross-platform/disallow-__source-as-jsx-attribute/input.js
* cross-platform/generated-jsx/input.js
* linux/auto-import-dev/input.js
* linux/classic-runtime/input.js
* linux/classic-runtime-babel-7/input.js
* linux/fragments/input.js
* linux/handle-fragments-with-key/input.js
* linux/handle-nonstatic-children/input.js
Expand All @@ -221,8 +228,10 @@ Passed: 178/392
* linux/source-and-self-defined/input.js
* linux/within-derived-classes-constructor/input.js
* linux/within-ts-module-block/input.ts
* linux/within-ts-module-block-babel-7/input.ts
* windows/auto-import-dev-windows/input.js
* windows/classic-runtime-windows/input.js
* windows/classic-runtime-windows-babel-7/input.js
* windows/fragments-windows/input.js
* windows/handle-fragments-with-key-windows/input.js
* windows/handle-nonstatic-children-windows/input.js
Expand All @@ -231,4 +240,5 @@ Passed: 178/392
* windows/source-and-self-defined-windows/input.js
* windows/within-derived-classes-constructor-windows/input.js
* windows/within-ts-module-block/input.ts
* windows/within-ts-module-block-babel-7/input.ts

10 changes: 6 additions & 4 deletions tasks/transform_conformance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn fixture_root() -> PathBuf {
snap_root().join("fixtures")
}

const CASES: &[&str] = &[
const PLUGINS: &[&str] = &[
// // ES2024
// "babel-plugin-transform-unicode-sets-regex",
// // ES2022
Expand Down Expand Up @@ -103,6 +103,9 @@ const CASES: &[&str] = &[
// "babel-plugin-proposal-decorators",
];

pub(crate) const PLUGINS_NOT_SUPPORTED_YET: &[&str] =
&["transform-object-rest-spread", "transform-modules-commonjs"];

const EXCLUDE_TESTS: &[&str] = &["babel-plugin-transform-typescript/test/fixtures/enum"];

const CONFORMANCE_SNAPSHOT: &str = "babel.snap.md";
Expand Down Expand Up @@ -155,7 +158,7 @@ impl TestRunner {
let mut transform_files = IndexMap::<String, Vec<TestCaseKind>>::new();
let mut exec_files = IndexMap::<String, Vec<TestCaseKind>>::new();

for case in CASES {
for case in PLUGINS {
let root = root.join(case).join("test/fixtures");
let (mut transform_paths, mut exec_paths): (Vec<TestCaseKind>, Vec<TestCaseKind>) =
WalkDir::new(root)
Expand All @@ -171,8 +174,7 @@ impl TestRunner {
if EXCLUDE_TESTS.iter().any(|p| path.to_string_lossy().contains(p)) {
return None;
}
TestCaseKind::from_path(path)
.filter(|test_case| !test_case.skip_test_case())
TestCaseKind::new(path).filter(|test_case| !test_case.skip_test_case())
})
.partition(|p| matches!(p, TestCaseKind::Transform(_)));

Expand Down
Loading
Loading