Skip to content

Commit

Permalink
test(transformer): support exec tests in Oxc folder (#7030)
Browse files Browse the repository at this point in the history
Fix error when `tasks/transform_conformance/tests` contains exec tests.
  • Loading branch information
overlookmotel committed Oct 31, 2024
1 parent 3d174bb commit 2a57a66
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tasks/transform_conformance/src/test_case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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::<Vec<&str>>()
.join("-");
normalize_path(unprefixed_path).split('/').collect::<Vec<&str>>().join("-");

let mut target_path = fixture_root().join(new_file_name);
target_path.set_extension("test.js");
Expand Down

0 comments on commit 2a57a66

Please sign in to comment.