Skip to content

Commit

Permalink
chore: update rust test error
Browse files Browse the repository at this point in the history
  • Loading branch information
ErKeLost committed Oct 14, 2024
1 parent 3ff6758 commit 5e02941
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 215 deletions.
118 changes: 1 addition & 117 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions crates/bench/Cargo.toml

This file was deleted.

56 changes: 0 additions & 56 deletions crates/bench/benches/compiler_bench.rs

This file was deleted.

16 changes: 11 additions & 5 deletions crates/plugin_css/tests/analyze_deps.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{collections::HashMap, sync::Arc};

use farmfe_core::{
config::{Config, ResolveConfig},
config::{AliasItem, Config, ResolveConfig, StringOrRegex},
context::CompilationContext,
module::{ModuleId, ModuleType},
plugin::{
Expand All @@ -17,10 +17,16 @@ fn analyze_deps() {
fixture!("tests/fixtures/analyze_deps/basic.css", |file, cwd| {
let config = Config {
resolve: Box::new(ResolveConfig {
alias: HashMap::from([
("/@".to_string(), cwd.to_string_lossy().to_string()),
("@".to_string(), cwd.to_string_lossy().to_string()),
]),
alias: vec![
AliasItem::Complex {
find: StringOrRegex::String("/@".to_string()),
replacement: cwd.to_string_lossy().to_string(),
},
AliasItem::Complex {
find: StringOrRegex::String("@".to_string()),
replacement: cwd.to_string_lossy().to_string(),
},
],
..Default::default()
}),
..Default::default()
Expand Down
35 changes: 20 additions & 15 deletions crates/plugin_resolve/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::{collections::HashMap, sync::Arc};

use farmfe_core::{
config::{Config, ResolveConfig},
config::{AliasItem, Config, ResolveConfig, StringOrRegex},
context::CompilationContext,
plugin::ResolveKind,
plugin::ResolveKind, regex::Regex,
};
use farmfe_plugin_resolve::resolver::{ResolveOptions, Resolver};
use farmfe_testing_helpers::fixture;
Expand Down Expand Up @@ -198,19 +198,24 @@ fn resolve_alias() {
CompilationContext::new(
Config {
resolve: Box::new(ResolveConfig {
alias: HashMap::from([
("@".to_string(), cwd.to_string_lossy().to_string()),
("/@".to_string(), cwd.to_string_lossy().to_string()),
// long alias
(
"@/components".to_string(),
cwd.join("components").to_string_lossy().to_string(),
),
(
"$__farm_regex:^/(utils)$".to_string(),
cwd.join("$1").to_string_lossy().to_string(),
),
]),
alias: vec![
AliasItem::Complex {
find: StringOrRegex::String("@".to_string()),
replacement: cwd.to_string_lossy().to_string(),
},
AliasItem::Complex {
find: StringOrRegex::String("/@".to_string()),
replacement: cwd.to_string_lossy().to_string(),
},
AliasItem::Complex {
find: StringOrRegex::String("@/components".to_string()),
replacement: cwd.join("components").to_string_lossy().to_string(),
},
AliasItem::Complex {
find: StringOrRegex::Regex(Regex::new("$__farm_regex:^/(utils)$").unwrap()),
replacement: cwd.join("$1").to_string_lossy().to_string(),
},
],
..Default::default()
}),
..Default::default()
Expand Down

0 comments on commit 5e02941

Please sign in to comment.