From 96a98ba5b94ac849f0b8e0433efd3419b5013f6c Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Wed, 30 Oct 2024 18:34:51 +0000 Subject: [PATCH] test(transformer): support exec tests in Oxc folder --- tasks/transform_conformance/src/test_case.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tasks/transform_conformance/src/test_case.rs b/tasks/transform_conformance/src/test_case.rs index 6d43abb508ea54..54f0a1c366b4ca 100644 --- a/tasks/transform_conformance/src/test_case.rs +++ b/tasks/transform_conformance/src/test_case.rs @@ -18,7 +18,7 @@ use oxc_tasks_common::{normalize_path, print_diff_in_terminal, project_root}; use crate::{ constants::{PLUGINS_NOT_SUPPORTED_YET, SKIP_TESTS}, driver::Driver, - fixture_root, packages_root, TestRunnerEnv, + fixture_root, oxc_test_root, packages_root, TestRunnerEnv, }; #[derive(Debug)] @@ -386,11 +386,14 @@ impl ExecTestCase { fn write_to_test_files(&self, content: &str) -> PathBuf { let allocator = Allocator::default(); + + let unprefixed_path = self + .path + .strip_prefix(packages_root()) + .or_else(|_| self.path.strip_prefix(oxc_test_root())) + .unwrap(); let new_file_name: String = - normalize_path(self.path.strip_prefix(packages_root()).unwrap()) - .split('/') - .collect::>() - .join("-"); + normalize_path(unprefixed_path).split('/').collect::>().join("-"); let mut target_path = fixture_root().join(new_file_name); target_path.set_extension("test.js");