@@ -623,6 +623,58 @@ def test_source_fingerprint_changes_with_local_edits(tmp_path: Path) -> None:
623623 assert run .source_fingerprint (tmp_path ) != untracked
624624
625625
626+ @pytest .mark .parametrize ("has_microvm_packages" , [False , True ])
627+ def test_build_produces_example_workspace_dependencies (
628+ tmp_path : Path ,
629+ monkeypatch : pytest .MonkeyPatch ,
630+ has_microvm_packages : bool ,
631+ ) -> None :
632+ core = "packages/aws-durable-execution-sdk-js"
633+ testing = "packages/aws-durable-execution-sdk-js-testing"
634+ otel = "packages/aws-durable-execution-sdk-js-otel"
635+ extras = "packages/aws-durable-execution-sdk-js-extras"
636+ worker = "packages/aws-durable-execution-sdk-js-microvm-worker"
637+ examples_package = "packages/aws-durable-execution-sdk-js-examples"
638+ packages = [core , testing , otel , examples_package ]
639+ if has_microvm_packages :
640+ packages .extend ([extras , worker ])
641+ for package in packages :
642+ directory = tmp_path / package
643+ directory .mkdir (parents = True )
644+ (directory / "package.json" ).write_text ("{}" )
645+
646+ built : list [str ] = []
647+
648+ def execute (args : list [str ], ** _kwargs : Any ) -> subprocess .CompletedProcess [str ]:
649+ if args [1 ] == "ci" :
650+ return subprocess .CompletedProcess (args , 0 )
651+ workspace = args [- 1 ]
652+ assert (tmp_path / workspace / "package.json" ).is_file ()
653+ if workspace == worker :
654+ assert testing in built
655+ if workspace == examples_package and has_microvm_packages :
656+ # The generator imports extras/microvm and typechecks the worker.
657+ # A successful examples build requires both artifacts to exist.
658+ assert extras in built
659+ assert worker in built
660+ built .append (workspace )
661+ return subprocess .CompletedProcess (args , 0 )
662+
663+ stamp = tmp_path / "built-stamp"
664+ monkeypatch .setattr (run , "_head" , lambda _ : "test-head" )
665+ monkeypatch .setattr (run , "state_file" , lambda * _ : stamp )
666+ monkeypatch .setattr (run , "source_fingerprint" , lambda _ : "fingerprint" )
667+ monkeypatch .setattr (run .shutil , "which" , lambda _ : "/fake/npm" )
668+ monkeypatch .setattr (run .subprocess , "run" , execute )
669+
670+ run .build_js_sdk (tmp_path , force = True )
671+
672+ assert built [- 1 ] == examples_package
673+ assert stamp .read_text () == "fingerprint\n "
674+ if not has_microvm_packages :
675+ assert built == [core , testing , otel , examples_package ]
676+
677+
626678def test_proxy_creates_the_dump_directory (tmp_path : Path ) -> None :
627679 dump_dir = tmp_path / "new" / "dump"
628680 proxy = invoke_proxy .ProxyServer (0 , "http://127.0.0.1:1" , dump_dir )
0 commit comments