From 2a356750ca225ff181eba7d5e190fd57975f76ff Mon Sep 17 00:00:00 2001 From: Bushuo Date: Sun, 4 May 2025 10:22:26 +0200 Subject: [PATCH 1/6] test: add tests for compiling dev dependencies --- testrepo/bsconfig.json | 7 +++--- testrepo/package.json | 3 ++- testrepo/packages/with-dev-deps/package.json | 12 ++++++++++ testrepo/packages/with-dev-deps/rescript.json | 17 ++++++++++++++ .../packages/with-dev-deps/src/FileToTest.mjs | 11 ++++++++++ .../packages/with-dev-deps/src/FileToTest.res | 1 + .../with-dev-deps/test/FileToTest_test.res | 6 +++++ tests/compile.sh | 22 +++++++++++++++++++ 8 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 testrepo/packages/with-dev-deps/package.json create mode 100644 testrepo/packages/with-dev-deps/rescript.json create mode 100644 testrepo/packages/with-dev-deps/src/FileToTest.mjs create mode 100644 testrepo/packages/with-dev-deps/src/FileToTest.res create mode 100644 testrepo/packages/with-dev-deps/test/FileToTest_test.res diff --git a/testrepo/bsconfig.json b/testrepo/bsconfig.json index 6a23b8d4..706ee906 100644 --- a/testrepo/bsconfig.json +++ b/testrepo/bsconfig.json @@ -19,15 +19,16 @@ "@testrepo/dep01", "@testrepo/dep02", "@testrepo/new-namespace", - "@testrepo/namespace-casing" - + "@testrepo/namespace-casing", + "@testrepo/with-dev-deps" ], "bs-dependencies": [ "@testrepo/main", "@testrepo/dep01", "@testrepo/dep02", "@testrepo/new-namespace", - "@testrepo/namespace-casing" + "@testrepo/namespace-casing", + "@testrepo/with-dev-deps" ], "reason": { "react-jsx": 3 diff --git a/testrepo/package.json b/testrepo/package.json index e9802c0f..c09461a3 100644 --- a/testrepo/package.json +++ b/testrepo/package.json @@ -7,7 +7,8 @@ "packages/dep01", "packages/dep02", "packages/new-namespace", - "packages/namespace-casing" + "packages/namespace-casing", + "packages/with-dev-deps" ] }, "scripts": { diff --git a/testrepo/packages/with-dev-deps/package.json b/testrepo/packages/with-dev-deps/package.json new file mode 100644 index 00000000..d096adcb --- /dev/null +++ b/testrepo/packages/with-dev-deps/package.json @@ -0,0 +1,12 @@ +{ + "name": "@testrepo/with-dev-deps", + "version": "0.0.1", + "keywords": [ + "rescript" + ], + "author": "", + "license": "MIT", + "dependencies": { + "rescript": "*" + } +} diff --git a/testrepo/packages/with-dev-deps/rescript.json b/testrepo/packages/with-dev-deps/rescript.json new file mode 100644 index 00000000..8cae5b6d --- /dev/null +++ b/testrepo/packages/with-dev-deps/rescript.json @@ -0,0 +1,17 @@ +{ + "name": "@testrepo/with-dev-deps", + "sources": [ + { + "dir": "src" + }, + { + "dir": "test", + "type": "dev" + } + ], + "package-specs": { + "module": "es6", + "in-source": true + }, + "suffix": ".res.js" +} diff --git a/testrepo/packages/with-dev-deps/src/FileToTest.mjs b/testrepo/packages/with-dev-deps/src/FileToTest.mjs new file mode 100644 index 00000000..33770330 --- /dev/null +++ b/testrepo/packages/with-dev-deps/src/FileToTest.mjs @@ -0,0 +1,11 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function add(a, b) { + return a + b | 0; +} + +export { + add , +} +/* No side effect */ diff --git a/testrepo/packages/with-dev-deps/src/FileToTest.res b/testrepo/packages/with-dev-deps/src/FileToTest.res new file mode 100644 index 00000000..65dd5f26 --- /dev/null +++ b/testrepo/packages/with-dev-deps/src/FileToTest.res @@ -0,0 +1 @@ +let add = (a, b) => a + b diff --git a/testrepo/packages/with-dev-deps/test/FileToTest_test.res b/testrepo/packages/with-dev-deps/test/FileToTest_test.res new file mode 100644 index 00000000..45c4bf01 --- /dev/null +++ b/testrepo/packages/with-dev-deps/test/FileToTest_test.res @@ -0,0 +1,6 @@ +let res = FileToTest.add(1, 2) +let expected = 3 + +if res !== expected { + failwith("Expected " ++ expected->Js.Int.toString ++ ", got " ++ res->Js.Int.toString) +} diff --git a/tests/compile.sh b/tests/compile.sh index 2697d274..2b47d720 100755 --- a/tests/compile.sh +++ b/tests/compile.sh @@ -74,6 +74,28 @@ rewatch build --no-timing=true &> ../tests/snapshots/dependency-cycle.txt git checkout -- packages/new-namespace/src/NS_alias.res rewatch build &> /dev/null +# it should compile dev dependencies with the --dev flag +rewatch build --dev &> /dev/null +file_count=$(find ./packages/with-dev-deps -name *.mjs | wc -l) +if [ "$file_count" -eq 2 ]; +then + success "Compiled dev dependencies successfully" +else + error "Expected 2 files to be compiled with the --dev flag, found $file_count" + exit 1 +fi + +rewatch clean &> /dev/null +file_count=$(find ./packages/with-dev-deps -name *.mjs | wc -l) +if [ "$file_count" -eq 0 ]; +then + success "Cleaned dev dependencies successfully" +else + error "Expected 0 files remaining after cleaning, found $file_count" + exit 1 +fi + + # it should not loop (we had an infinite loop when clean building with a cycle) rewatch clean &> /dev/null echo 'Dep01.log()' >> packages/new-namespace/src/NS_alias.res From 2a4cab090dc50dec705f6047ec8b2111741b0004 Mon Sep 17 00:00:00 2001 From: Bushuo Date: Sun, 4 May 2025 10:40:36 +0200 Subject: [PATCH 2/6] fix: do not skip sources marked as "dev" --- src/build.rs | 20 +++++++++++++++++--- src/build/clean.rs | 9 ++++++++- src/build/compile.rs | 6 +++--- src/build/packages.rs | 24 ++++++++++++++---------- src/config.rs | 34 ++++++++++++++++++++++++++++++++++ src/watcher.rs | 9 +++++---- 6 files changed, 81 insertions(+), 21 deletions(-) diff --git a/src/build.rs b/src/build.rs index 2892584f..ef312c9c 100644 --- a/src/build.rs +++ b/src/build.rs @@ -134,6 +134,7 @@ pub fn initialize_build( show_progress: bool, path: &str, bsc_path: Option, + build_dev_deps: bool, ) -> Result { let project_root = helpers::get_abs_path(path); let workspace_root = helpers::get_workspace_root(&project_root); @@ -150,7 +151,13 @@ pub fn initialize_build( } let timing_package_tree = Instant::now(); - let packages = packages::make(filter, &project_root, &workspace_root, show_progress)?; + let packages = packages::make( + filter, + &project_root, + &workspace_root, + show_progress, + build_dev_deps, + )?; let timing_package_tree_elapsed = timing_package_tree.elapsed(); if show_progress { @@ -476,8 +483,15 @@ pub fn build( None }; let timing_total = Instant::now(); - let mut build_state = initialize_build(default_timing, filter, show_progress, path, bsc_path) - .map_err(|e| anyhow!("Could not initialize build. Error: {e}"))?; + let mut build_state = initialize_build( + default_timing, + filter, + show_progress, + path, + bsc_path, + build_dev_deps, + ) + .map_err(|e| anyhow!("Could not initialize build. Error: {e}"))?; match incremental_build( &mut build_state, diff --git a/src/build/clean.rs b/src/build/clean.rs index ab603b2f..0cc4142e 100644 --- a/src/build/clean.rs +++ b/src/build/clean.rs @@ -326,7 +326,14 @@ pub fn cleanup_after_build(build_state: &BuildState) { pub fn clean(path: &str, show_progress: bool, bsc_path: Option) -> Result<()> { let project_root = helpers::get_abs_path(path); let workspace_root = helpers::get_workspace_root(&project_root); - let packages = packages::make(&None, &project_root, &workspace_root, show_progress)?; + let packages = packages::make( + &None, + &project_root, + &workspace_root, + show_progress, + // Always clean dev dependencies + true, + )?; let root_config_name = packages::read_package_name(&project_root)?; let bsc_path = match bsc_path { Some(bsc_path) => bsc_path, diff --git a/src/build/compile.rs b/src/build/compile.rs index d3f43921..16757cfb 100644 --- a/src/build/compile.rs +++ b/src/build/compile.rs @@ -148,7 +148,7 @@ pub fn compile( "cmi", ); - let cmi_digest = helpers::compute_file_hash(&Path::new(&cmi_path)); + let cmi_digest = helpers::compute_file_hash(Path::new(&cmi_path)); let package = build_state .get_package(&module.package_name) @@ -189,7 +189,7 @@ pub fn compile( &build_state.workspace_root, build_dev_deps, ); - let cmi_digest_after = helpers::compute_file_hash(&Path::new(&cmi_path)); + let cmi_digest_after = helpers::compute_file_hash(Path::new(&cmi_path)); // we want to compare both the hash of interface and the implementation // compile assets to verify that nothing changed. We also need to checke the interface @@ -326,7 +326,7 @@ pub fn compile( if files_total_count == compile_universe_count { break; } - if in_progress_modules.len() == 0 || in_progress_modules.eq(¤t_in_progres_modules) { + if in_progress_modules.is_empty() || in_progress_modules.eq(¤t_in_progres_modules) { // find the dependency cycle let cycle = dependency_cycle::find( &compile_universe diff --git a/src/build/packages.rs b/src/build/packages.rs index de4bd745..d458ccc7 100644 --- a/src/build/packages.rs +++ b/src/build/packages.rs @@ -480,6 +480,7 @@ pub fn get_source_files( package_dir: &Path, filter: &Option, source: &config::PackageSource, + build_dev_deps: bool, ) -> AHashMap { let mut map: AHashMap = AHashMap::new(); @@ -493,16 +494,9 @@ pub fn get_source_files( }; let path_dir = Path::new(&source.dir); - // don't include dev sources for now - if type_ != &Some("dev".to_string()) { + if (build_dev_deps && type_ == &Some("dev".to_string())) || type_ != &Some("dev".to_string()) { match read_folders(filter, package_dir, path_dir, recurse) { Ok(files) => map.extend(files), - // Err(_e) if type_ == &Some("dev".to_string()) => { - // log::warn!( - // "Could not read folder: {}... Probably ok as type is dev", - // path_dir.to_string_lossy() - // ) - // } Err(_e) => log::error!( "Could not read folder: {:?}. Specified in dependency: {}, located {:?}...", path_dir.to_path_buf().into_os_string(), @@ -520,13 +514,22 @@ pub fn get_source_files( fn extend_with_children( filter: &Option, mut build: AHashMap, + build_dev_deps: bool, ) -> AHashMap { for (_key, package) in build.iter_mut() { let mut map: AHashMap = AHashMap::new(); package .source_folders .par_iter() - .map(|source| get_source_files(&package.name, Path::new(&package.path), filter, source)) + .map(|source| { + get_source_files( + &package.name, + Path::new(&package.path), + filter, + source, + build_dev_deps, + ) + }) .collect::>>() .into_iter() .for_each(|source| map.extend(source)); @@ -568,12 +571,13 @@ pub fn make( root_folder: &str, workspace_root: &Option, show_progress: bool, + build_dev_deps: bool, ) -> Result> { let map = read_packages(root_folder, workspace_root.to_owned(), show_progress)?; /* Once we have the deduplicated packages, we can add the source files for each - to minimize * the IO */ - let result = extend_with_children(filter, map); + let result = extend_with_children(filter, map, build_dev_deps); Ok(result) } diff --git a/src/config.rs b/src/config.rs index 8bb2cb64..c48b5d25 100644 --- a/src/config.rs +++ b/src/config.rs @@ -505,6 +505,40 @@ mod tests { } } + #[test] + fn test_dev_sources_multiple() { + let json = r#" + { + "name": "@rescript/core", + "version": "0.5.0", + "sources": [ + { "dir": "src" }, + { "dir": "test", "type": "dev" } + ], + "package-specs": { + "module": "esmodule", + "in-source": true + }, + "bs-dev-dependencies": ["@rescript/tools"], + "suffix": ".mjs", + "warnings": { + "error": "+101" + } + } + "#; + + let config = serde_json::from_str::(json).unwrap(); + if let Some(OneOrMore::Multiple(sources)) = config.sources { + let src_dir = sources[0].to_qualified_without_children(None); + let test_dir = sources[1].to_qualified_without_children(None); + + assert_eq!(test_dir.type_, Some(String::from("dev"))); + } else { + dbg!(config.sources); + unreachable!() + } + } + #[test] fn test_detect_gentypeconfig() { let json = r#" diff --git a/src/watcher.rs b/src/watcher.rs index c58ed3fd..3846e2f9 100644 --- a/src/watcher.rs +++ b/src/watcher.rs @@ -55,8 +55,8 @@ async fn async_watch( create_sourcedirs: bool, build_dev_deps: bool, ) -> notify::Result<()> { - let mut build_state = - build::initialize_build(None, filter, show_progress, path, None).expect("Can't initialize build"); + let mut build_state = build::initialize_build(None, filter, show_progress, path, None, build_dev_deps) + .expect("Can't initialize build"); let mut needs_compile_type = CompileType::Incremental; // create a mutex to capture if ctrl-c was pressed let ctrlc_pressed = Arc::new(Mutex::new(false)); @@ -214,8 +214,9 @@ async fn async_watch( } CompileType::Full => { let timing_total = Instant::now(); - build_state = build::initialize_build(None, filter, show_progress, path, None) - .expect("Can't initialize build"); + build_state = + build::initialize_build(None, filter, show_progress, path, None, build_dev_deps) + .expect("Can't initialize build"); let _ = build::incremental_build( &mut build_state, None, From b249e9ef49597b3a5e414171fd77f126d3668d64 Mon Sep 17 00:00:00 2001 From: Bushuo Date: Sun, 4 May 2025 10:40:57 +0200 Subject: [PATCH 3/6] test: update snapshots --- tests/snapshots/dependency-cycle.txt | 24 ++++++++++++------- tests/snapshots/remove-file.txt | 24 ++++++++++++------- .../rename-file-internal-dep-namespace.txt | 2 +- tests/snapshots/rename-file-internal-dep.txt | 2 +- .../snapshots/rename-file-with-interface.txt | 2 +- tests/snapshots/rename-file.txt | 2 +- tests/snapshots/rename-interface-file.txt | 2 +- 7 files changed, 37 insertions(+), 21 deletions(-) diff --git a/tests/snapshots/dependency-cycle.txt b/tests/snapshots/dependency-cycle.txt index 2ff57f31..caeb697e 100644 --- a/tests/snapshots/dependency-cycle.txt +++ b/tests/snapshots/dependency-cycle.txt @@ -1,10 +1,17 @@ -[1/7] ๐Ÿ“ฆ Building package tree... [1/7] ๐Ÿ“ฆ Built package tree in 0.00s -[2/7] ๐Ÿ‘€ Finding source files... [2/7] ๐Ÿ‘€ Found source files in 0.00s -[3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 0/13 0.00s - [5/7] ๐Ÿงฑ Parsed 1 source files in 0.00s - [6/7] ๐ŸŒด Collected deps in 0.00s - [7/7] โŒ Compiled 0 modules in 0.00s +[1/7] ๐Ÿ“ฆ Building package tree... +[1/7] ๐Ÿ“ฆ Built package tree in 0.00s +[2/7] ๐Ÿ‘€ Finding source files... +[2/7] ๐Ÿ‘€ Found source files in 0.00s +[3/7] ๐Ÿ“ Reading compile state... +[3/7] ๐Ÿ“ Read compile state 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... +[4/7] ๐Ÿงน Cleaned 0/13 0.00s + +[5/7] ๐Ÿงฑ Parsed 1 source files in 0.00s + +[6/7] ๐ŸŒด Collected deps in 0.00s + +[7/7] โŒ Compiled 0 modules in 0.00s Can't continue... Found a circular dependency in your code: Dep01 @@ -13,4 +20,5 @@ Dep01 โ†’ NewNamespace.NS_alias โ†’ Dep01 -Incremental build failed. Error:  โŒ Failed to Compile. See Errors Above +Incremental build failed. Error:  + โŒ Failed to Compile. See Errors Above diff --git a/tests/snapshots/remove-file.txt b/tests/snapshots/remove-file.txt index 71baf8f9..d479d6b2 100644 --- a/tests/snapshots/remove-file.txt +++ b/tests/snapshots/remove-file.txt @@ -1,10 +1,17 @@ -[1/7] ๐Ÿ“ฆ Building package tree... [1/7] ๐Ÿ“ฆ Built package tree in 0.00s -[2/7] ๐Ÿ‘€ Finding source files... [2/7] ๐Ÿ‘€ Found source files in 0.00s -[3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/13 0.00s - [5/7] ๐Ÿงฑ Parsed 0 source files in 0.00s - [6/7] ๐ŸŒด Collected deps in 0.00s - [7/7] โŒ Compiled 1 modules in 0.00s +[1/7] ๐Ÿ“ฆ Building package tree... +[1/7] ๐Ÿ“ฆ Built package tree in 0.00s +[2/7] ๐Ÿ‘€ Finding source files... +[2/7] ๐Ÿ‘€ Found source files in 0.00s +[3/7] ๐Ÿ“ Reading compile state... +[3/7] ๐Ÿ“ Read compile state 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... +[4/7] ๐Ÿงน Cleaned 1/13 0.00s + +[5/7] ๐Ÿงฑ Parsed 0 source files in 0.00s + +[6/7] ๐ŸŒด Collected deps in 0.00s + +[7/7] โŒ Compiled 1 modules in 0.00s We've found a bug for you! /packages/dep01/src/Dep01.res:3:9-17 @@ -22,4 +29,5 @@ -Incremental build failed. Error:  โŒ Failed to Compile. See Errors Above +Incremental build failed. Error:  + โŒ Failed to Compile. See Errors Above diff --git a/tests/snapshots/rename-file-internal-dep-namespace.txt b/tests/snapshots/rename-file-internal-dep-namespace.txt index 02ac93fb..42acc1b1 100644 --- a/tests/snapshots/rename-file-internal-dep-namespace.txt +++ b/tests/snapshots/rename-file-internal-dep-namespace.txt @@ -1,7 +1,7 @@ [1/7] ๐Ÿ“ฆ Building package tree... [1/7] ๐Ÿ“ฆ Built package tree in 0.00s [2/7] ๐Ÿ‘€ Finding source files... [2/7] ๐Ÿ‘€ Found source files in 0.00s [3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/13 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/12 0.00s  [5/7] ๐Ÿงฑ Parsed 2 source files in 0.00s  [6/7] ๐ŸŒด Collected deps in 0.00s  [7/7] โŒ Compiled 3 modules in 0.00s diff --git a/tests/snapshots/rename-file-internal-dep.txt b/tests/snapshots/rename-file-internal-dep.txt index 4332689b..765b8ff1 100644 --- a/tests/snapshots/rename-file-internal-dep.txt +++ b/tests/snapshots/rename-file-internal-dep.txt @@ -1,7 +1,7 @@ [1/7] ๐Ÿ“ฆ Building package tree... [1/7] ๐Ÿ“ฆ Built package tree in 0.00s [2/7] ๐Ÿ‘€ Finding source files... [2/7] ๐Ÿ‘€ Found source files in 0.00s [3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/13 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/12 0.00s  [5/7] ๐Ÿงฑ Parsed 2 source files in 0.00s  [6/7] ๐ŸŒด Collected deps in 0.00s  [7/7] โŒ Compiled 2 modules in 0.00s diff --git a/tests/snapshots/rename-file-with-interface.txt b/tests/snapshots/rename-file-with-interface.txt index 27ad665b..ab07763c 100644 --- a/tests/snapshots/rename-file-with-interface.txt +++ b/tests/snapshots/rename-file-with-interface.txt @@ -3,7 +3,7 @@  No implementation file found for interface file (skipping): src/ModuleWithInterface.resi  [2/7] ๐Ÿ‘€ Found source files in 0.00s [3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/13 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/12 0.00s  [5/7] ๐Ÿงฑ Parsed 1 source files in 0.00s  [6/7] ๐ŸŒด Collected deps in 0.00s  [7/7] ๐Ÿคบ Compiled 2 modules in 0.00s diff --git a/tests/snapshots/rename-file.txt b/tests/snapshots/rename-file.txt index 3e4c0759..85d1a6cb 100644 --- a/tests/snapshots/rename-file.txt +++ b/tests/snapshots/rename-file.txt @@ -1,7 +1,7 @@ [1/7] ๐Ÿ“ฆ Building package tree... [1/7] ๐Ÿ“ฆ Built package tree in 0.00s [2/7] ๐Ÿ‘€ Finding source files... [2/7] ๐Ÿ‘€ Found source files in 0.00s [3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/13 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/12 0.00s  [5/7] ๐Ÿงฑ Parsed 1 source files in 0.00s  [6/7] ๐ŸŒด Collected deps in 0.00s  [7/7] ๐Ÿคบ Compiled 1 modules in 0.00s diff --git a/tests/snapshots/rename-interface-file.txt b/tests/snapshots/rename-interface-file.txt index 7c3b8c0b..b777f8e8 100644 --- a/tests/snapshots/rename-interface-file.txt +++ b/tests/snapshots/rename-interface-file.txt @@ -3,7 +3,7 @@  No implementation file found for interface file (skipping): src/ModuleWithInterface2.resi  [2/7] ๐Ÿ‘€ Found source files in 0.00s [3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/13 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/12 0.00s  [5/7] ๐Ÿงฑ Parsed 1 source files in 0.00s  [6/7] ๐ŸŒด Collected deps in 0.00s  [7/7] ๐Ÿคบ Compiled 2 modules in 0.00s From 52e38354a017c25fd94e4a073413b080ebd575e2 Mon Sep 17 00:00:00 2001 From: Bushuo Date: Sun, 4 May 2025 11:05:04 +0200 Subject: [PATCH 4/6] fix: try fix snapshot --- testrepo/yarn.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testrepo/yarn.lock b/testrepo/yarn.lock index 9f859581..2a3f684a 100644 --- a/testrepo/yarn.lock +++ b/testrepo/yarn.lock @@ -4,5 +4,5 @@ rescript@*: version "11.0.0" - resolved "https://registry.npmjs.org/rescript/-/rescript-11.0.0.tgz" + resolved "https://registry.yarnpkg.com/rescript/-/rescript-11.0.0.tgz#9a0b6fc998c360543c459aba49b77a572a0306cd" integrity sha512-uIUwDZZmDUb7ymGkBiiGioxMg8hXh1mze/2k/qhYQcZGgi7PrLHQIW9AksM7gb9WnpjCAvFsA8U2VgC0nA468w== From 15888d76e451ff524a193973683aa3358f116e83 Mon Sep 17 00:00:00 2001 From: Bushuo Date: Sun, 4 May 2025 11:17:06 +0200 Subject: [PATCH 5/6] update snapshots --- tests/snapshots/dependency-cycle.txt | 24 +++++++------------ tests/snapshots/remove-file.txt | 24 +++++++------------ .../rename-file-internal-dep-namespace.txt | 2 +- tests/snapshots/rename-file-internal-dep.txt | 2 +- .../snapshots/rename-file-with-interface.txt | 2 +- tests/snapshots/rename-file.txt | 2 +- tests/snapshots/rename-interface-file.txt | 2 +- 7 files changed, 21 insertions(+), 37 deletions(-) diff --git a/tests/snapshots/dependency-cycle.txt b/tests/snapshots/dependency-cycle.txt index caeb697e..e8b6db1b 100644 --- a/tests/snapshots/dependency-cycle.txt +++ b/tests/snapshots/dependency-cycle.txt @@ -1,17 +1,10 @@ -[1/7] ๐Ÿ“ฆ Building package tree... -[1/7] ๐Ÿ“ฆ Built package tree in 0.00s -[2/7] ๐Ÿ‘€ Finding source files... -[2/7] ๐Ÿ‘€ Found source files in 0.00s -[3/7] ๐Ÿ“ Reading compile state... -[3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... -[4/7] ๐Ÿงน Cleaned 0/13 0.00s - -[5/7] ๐Ÿงฑ Parsed 1 source files in 0.00s - -[6/7] ๐ŸŒด Collected deps in 0.00s - -[7/7] โŒ Compiled 0 modules in 0.00s +[1/7] ๐Ÿ“ฆ Building package tree... [1/7] ๐Ÿ“ฆ Built package tree in 0.00s +[2/7] ๐Ÿ‘€ Finding source files... [2/7] ๐Ÿ‘€ Found source files in 0.00s +[3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 0/14 0.00s + [5/7] ๐Ÿงฑ Parsed 1 source files in 0.00s + [6/7] ๐ŸŒด Collected deps in 0.00s + [7/7] โŒ Compiled 0 modules in 0.00s Can't continue... Found a circular dependency in your code: Dep01 @@ -20,5 +13,4 @@ Dep01 โ†’ NewNamespace.NS_alias โ†’ Dep01 -Incremental build failed. Error:  - โŒ Failed to Compile. See Errors Above +Incremental build failed. Error:  โŒ Failed to Compile. See Errors Above diff --git a/tests/snapshots/remove-file.txt b/tests/snapshots/remove-file.txt index d479d6b2..4d3a64e6 100644 --- a/tests/snapshots/remove-file.txt +++ b/tests/snapshots/remove-file.txt @@ -1,17 +1,10 @@ -[1/7] ๐Ÿ“ฆ Building package tree... -[1/7] ๐Ÿ“ฆ Built package tree in 0.00s -[2/7] ๐Ÿ‘€ Finding source files... -[2/7] ๐Ÿ‘€ Found source files in 0.00s -[3/7] ๐Ÿ“ Reading compile state... -[3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... -[4/7] ๐Ÿงน Cleaned 1/13 0.00s - -[5/7] ๐Ÿงฑ Parsed 0 source files in 0.00s - -[6/7] ๐ŸŒด Collected deps in 0.00s - -[7/7] โŒ Compiled 1 modules in 0.00s +[1/7] ๐Ÿ“ฆ Building package tree... [1/7] ๐Ÿ“ฆ Built package tree in 0.00s +[2/7] ๐Ÿ‘€ Finding source files... [2/7] ๐Ÿ‘€ Found source files in 0.00s +[3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/14 0.00s + [5/7] ๐Ÿงฑ Parsed 0 source files in 0.00s + [6/7] ๐ŸŒด Collected deps in 0.00s + [7/7] โŒ Compiled 1 modules in 0.00s We've found a bug for you! /packages/dep01/src/Dep01.res:3:9-17 @@ -29,5 +22,4 @@ -Incremental build failed. Error:  - โŒ Failed to Compile. See Errors Above +Incremental build failed. Error:  โŒ Failed to Compile. See Errors Above diff --git a/tests/snapshots/rename-file-internal-dep-namespace.txt b/tests/snapshots/rename-file-internal-dep-namespace.txt index 42acc1b1..bedaa2d8 100644 --- a/tests/snapshots/rename-file-internal-dep-namespace.txt +++ b/tests/snapshots/rename-file-internal-dep-namespace.txt @@ -1,7 +1,7 @@ [1/7] ๐Ÿ“ฆ Building package tree... [1/7] ๐Ÿ“ฆ Built package tree in 0.00s [2/7] ๐Ÿ‘€ Finding source files... [2/7] ๐Ÿ‘€ Found source files in 0.00s [3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/12 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/14 0.00s  [5/7] ๐Ÿงฑ Parsed 2 source files in 0.00s  [6/7] ๐ŸŒด Collected deps in 0.00s  [7/7] โŒ Compiled 3 modules in 0.00s diff --git a/tests/snapshots/rename-file-internal-dep.txt b/tests/snapshots/rename-file-internal-dep.txt index 765b8ff1..deacd3ac 100644 --- a/tests/snapshots/rename-file-internal-dep.txt +++ b/tests/snapshots/rename-file-internal-dep.txt @@ -1,7 +1,7 @@ [1/7] ๐Ÿ“ฆ Building package tree... [1/7] ๐Ÿ“ฆ Built package tree in 0.00s [2/7] ๐Ÿ‘€ Finding source files... [2/7] ๐Ÿ‘€ Found source files in 0.00s [3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/12 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/14 0.00s  [5/7] ๐Ÿงฑ Parsed 2 source files in 0.00s  [6/7] ๐ŸŒด Collected deps in 0.00s  [7/7] โŒ Compiled 2 modules in 0.00s diff --git a/tests/snapshots/rename-file-with-interface.txt b/tests/snapshots/rename-file-with-interface.txt index ab07763c..7f25c664 100644 --- a/tests/snapshots/rename-file-with-interface.txt +++ b/tests/snapshots/rename-file-with-interface.txt @@ -3,7 +3,7 @@  No implementation file found for interface file (skipping): src/ModuleWithInterface.resi  [2/7] ๐Ÿ‘€ Found source files in 0.00s [3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/12 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/14 0.00s  [5/7] ๐Ÿงฑ Parsed 1 source files in 0.00s  [6/7] ๐ŸŒด Collected deps in 0.00s  [7/7] ๐Ÿคบ Compiled 2 modules in 0.00s diff --git a/tests/snapshots/rename-file.txt b/tests/snapshots/rename-file.txt index 85d1a6cb..cf5109cf 100644 --- a/tests/snapshots/rename-file.txt +++ b/tests/snapshots/rename-file.txt @@ -1,7 +1,7 @@ [1/7] ๐Ÿ“ฆ Building package tree... [1/7] ๐Ÿ“ฆ Built package tree in 0.00s [2/7] ๐Ÿ‘€ Finding source files... [2/7] ๐Ÿ‘€ Found source files in 0.00s [3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/12 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/14 0.00s  [5/7] ๐Ÿงฑ Parsed 1 source files in 0.00s  [6/7] ๐ŸŒด Collected deps in 0.00s  [7/7] ๐Ÿคบ Compiled 1 modules in 0.00s diff --git a/tests/snapshots/rename-interface-file.txt b/tests/snapshots/rename-interface-file.txt index b777f8e8..67475cbd 100644 --- a/tests/snapshots/rename-interface-file.txt +++ b/tests/snapshots/rename-interface-file.txt @@ -3,7 +3,7 @@  No implementation file found for interface file (skipping): src/ModuleWithInterface2.resi  [2/7] ๐Ÿ‘€ Found source files in 0.00s [3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/12 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/14 0.00s  [5/7] ๐Ÿงฑ Parsed 1 source files in 0.00s  [6/7] ๐ŸŒด Collected deps in 0.00s  [7/7] ๐Ÿคบ Compiled 2 modules in 0.00s From 61ad2e2b81498e0dd4a57d3fba064305af2ed26e Mon Sep 17 00:00:00 2001 From: Bushuo Date: Sun, 4 May 2025 11:23:46 +0200 Subject: [PATCH 6/6] test: update suffix file count --- tests/suffix.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/suffix.sh b/tests/suffix.sh index ea072965..bd9d52f7 100755 --- a/tests/suffix.sh +++ b/tests/suffix.sh @@ -27,7 +27,7 @@ fi # Count files with new extension file_count=$(find . -name *.res.js | wc -l) -if [ "$file_count" -eq 24 ]; +if [ "$file_count" -eq 26 ]; then success "Found files with correct suffix" else