diff --git a/docs/agent-workflow/STATE.md b/docs/agent-workflow/STATE.md index 1ee212f..e55f638 100644 --- a/docs/agent-workflow/STATE.md +++ b/docs/agent-workflow/STATE.md @@ -354,6 +354,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B - **Wave 130 (CI Hardening)**: the VoidLibrary workflow (`build-vbs`) now guards for GCC 16+, and adds sanitizer (ASan+UBSan core suites) and libFuzzer jobs; it passes `yamllint` (valid YAML, only line-length warnings). VBS's own CI gained the matching fuzz job. Workflows remain unexecuted without runners. +- **Wave 131 (Warm-Build Latency & Generated Plugin Tests)**: descriptor identity hashing is memoized by stat fingerprint (size + mtime) in `.vbs/config/identity_cache.json`, and cached header entries carry the same fingerprint, so unchanged inputs are not re-hashed. In the benchmark project the descriptor check fell from ~106 ms to ~0.8 ms and `benchmarks/compare.sh` warm no-op from ~209 ms to **92 ms** (CMake 8 ms, Meson 175 ms on the same 20-source project). `vbs ide plugin --editor vscode` now also emits `test/extension.test.js` plus an `npm test` script, and the generated harness was executed with Node against a mocked VS Code API (6 commands passed). + ## Remaining future scope - **Superiority plan ([22-superiority-and-gaps.md](../roadmap/22-superiority-and-gaps.md), 2026-12-05)**: revised platform strategy - **macOS deferred**, **Windows via MinGW-w64 cross-compilation + Wine execution** (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`, `dev cpp-gcc -p wine64`), native MSVC deferred; plus packaging parity (ZIP/DEB/RPM), IDE ecosystem, migration tooling, test-runner parity, benchmarks, CI runners, and remote execution in prioritized order. diff --git a/docs/agent-workflow/TASKS.md b/docs/agent-workflow/TASKS.md index f7f532d..47ccd35 100644 --- a/docs/agent-workflow/TASKS.md +++ b/docs/agent-workflow/TASKS.md @@ -131,4 +131,5 @@ Base HEAD: `fe0d1a6` | Wave 126 (VoidLibrary test wiring) | Per-module package tests declared in the branch build.cpp; CI runs `vbs test` | COMPLETE & VERIFIED IN CLONE (156 actions; module test binaries PASSED, exit 0) | [Void/Library build-vbs](https://git.faumaray.com/Void/Library/src/branch/build-vbs), `contrib/voidlibrary-migration/`, docs | | Wave 127 (Continuous worker loop) | `vbs worker --queue` loop with local record export, retries, skip-on-missing, `--once`, exit on empty queue | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; worker E2E passes, full CTest 8/8) | `src/Main.cpp`, `tests/RegistryTests.cpp`, docs | | Wave 128 (Lease renewal + idle timeout) | `actions//renew`, `renew_action_lease`, `worker --idle-timeout/--once` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; worker E2E passes, full CTest 8/8) | `registry/service/RegistryService.cpp`, `src/Package/RegistryClient.cpp`, `src/Main.cpp`, `tests/RegistryTests.cpp`, docs | +| Wave 131 (warm-build latency + plugin tests) | Stat-fingerprint memo for descriptor identity/header hashes; generated VS Code test harness | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; vbs warm 92 ms vs 209 ms baseline, generated harness passes under Node, full CTest 8/8) | `src/Config/Frontend.cpp`, `src/Editor/CompDb.cpp`, `tests/FullV1Tests.cpp`, `benchmarks/compare.sh`, docs | | Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions) |"}] Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) | diff --git a/docs/agent-workflow/VERIFICATION.md b/docs/agent-workflow/VERIFICATION.md index fd53476..c65d77c 100644 --- a/docs/agent-workflow/VERIFICATION.md +++ b/docs/agent-workflow/VERIFICATION.md @@ -1727,6 +1727,20 @@ VOID_INCLUDE_DIR=/tmp/opencode/vl-pin/include dev cpp -c bash fuzz/run.sh 30 - `RegistryTests.worker_cli_leases_publishes_and_reports_result` **passed** (1.54 s): the idle worker ran for >= 900 ms, renewal succeeded, and a wrong token was rejected. - Full CTest: **8 / 8 passed** in 302.11 s. +## Warm-Build Latency (GCC 16.2, pin `0002e74`) + +- Descriptor identity inputs and cached headers are hashed only when their stat fingerprint + (size + mtime, persisted in `.vbs/config/identity_cache.json` / `.headers.json`) changes. + Legacy hash-only metadata is upgraded in place. +- Descriptor check on the benchmark project: **~106 ms before, ~0.8 ms warm after** (the first + run seeds the memo once). +- `benchmarks/compare.sh` (20 sources): **vbs-warm 92 ms** (was ~209 ms), cmake-warm 8 ms, + meson-warm 175 ms; vbs-cold 2580 ms, cmake-cold 97 ms, meson-cold 246 ms. +- `vbs ide plugin --editor vscode` emits `test/extension.test.js` and `npm test`; running the + generated harness with Node 24 against a mocked VS Code API prints + `extension tests passed: 6 commands`. +- Full CTest: **8 / 8 passed** in 288.56 s. + ## Limits and Unrun Checks 1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified). diff --git a/src/Config/Frontend.cpp b/src/Config/Frontend.cpp index 28e45dc..cffa66d 100644 --- a/src/Config/Frontend.cpp +++ b/src/Config/Frontend.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -32,6 +33,31 @@ bool is_cpp_file(const std::filesystem::path &p) { return ext == ".cpp" || ext == ".cc" || ext == ".cxx"; } +// Cheap identity of a header file: content hashing is only needed when this changes. +struct HeaderFingerprint { + std::int64_t size{0}; + std::int64_t mtime{0}; + + bool operator==(const HeaderFingerprint &) const = default; +}; + +std::optional stat_fingerprint(const std::filesystem::path &path) { + std::error_code ec; + if (!std::filesystem::is_regular_file(path, ec)) { + return std::nullopt; + } + const auto size = std::filesystem::file_size(path, ec); + if (ec) { + return std::nullopt; + } + const auto mtime = std::filesystem::last_write_time(path, ec); + if (ec) { + return std::nullopt; + } + return HeaderFingerprint{static_cast(size), + static_cast(mtime.time_since_epoch().count())}; +} + std::string generate_driver_source(bool has_profiles_file, bool has_build_file, bool has_workspace_file) { std::string code = R"cpp(#include @@ -267,6 +293,93 @@ std::vector get_str_array(const JsonVal::Object &obj, const std::st return out; } +// Persisted stat-fingerprint -> content-hash memo for descriptor identity inputs. Large SDK +// artifacts are hashed once and then trusted until their size or mtime changes. +class FileHashMemo { + public: + explicit FileHashMemo(std::filesystem::path cache_file) : cache_file_{std::move(cache_file)} { + auto text = Void::FileSystem::read_file(cache_file_); + if (!text) { + return; + } + auto parsed = Void::Json::Strict::parse(*text); + if (!parsed) { + return; + } + const auto *root = std::get_if(&parsed->value); + if (root == nullptr) { + return; + } + const auto *files_v = find_key(*root, "files"); + const auto *files = files_v ? std::get_if(&files_v->value) : nullptr; + if (files == nullptr) { + return; + } + for (const auto &[path, value] : *files) { + const auto *entry = std::get_if(&value.value); + if (entry == nullptr) { + continue; + } + auto sha = get_str(*entry, "sha256"); + auto size = get_i64(*entry, "size"); + auto mtime = get_i64(*entry, "mtime"); + if (sha && size && mtime) { + entries_[path] = Entry{std::move(*sha), HeaderFingerprint{*size, *mtime}}; + } + } + } + + [[nodiscard]] std::optional lookup(const std::filesystem::path &path, + const HeaderFingerprint &fingerprint) const { + const auto it = entries_.find(path.string()); + if (it != entries_.end() && it->second.fingerprint == fingerprint) { + return it->second.sha256; + } + return std::nullopt; + } + + void store(const std::filesystem::path &path, const HeaderFingerprint &fingerprint, + std::string sha256) { + const auto key = path.string(); + const auto it = entries_.find(key); + if (it != entries_.end() && it->second.fingerprint == fingerprint && + it->second.sha256 == sha256) { + return; + } + entries_[key] = Entry{std::move(sha256), fingerprint}; + dirty_ = true; + } + + void flush() { + if (!dirty_) { + return; + } + std::string json = "{\"files\":{"; + bool first = true; + for (const auto &[path, entry] : entries_) { + if (!first) { + json += ','; + } + first = false; + json += Util::json_quote(path) + ":{\"sha256\":" + Util::json_quote(entry.sha256) + + ",\"size\":" + std::to_string(entry.fingerprint.size) + + ",\"mtime\":" + std::to_string(entry.fingerprint.mtime) + '}'; + } + json += "}}\n"; + (void)Platform::atomic_write_file(cache_file_, json, false); + dirty_ = false; + } + + private: + struct Entry { + std::string sha256; + HeaderFingerprint fingerprint; + }; + std::filesystem::path cache_file_; + std::map> entries_; + bool dirty_{false}; +}; + } // namespace Void::Result::Result, Void::Result::Error> @@ -340,10 +453,13 @@ discover_config_sources(const std::filesystem::path &project_root, Void::Result::Result compile_descriptor(const FrontendOptions &options) { + const auto phase_sw = Void::Time::Stopwatch::started(); auto sources_res = discover_config_sources(options.project_root, options.extra_build_sources); if (!sources_res) { return std::unexpected{sources_res.error()}; } + Void::Log::debug("Config", "descriptor sources discovered in {:.1f} ms ({} source(s))", + phase_sw.elapsed_ms(), sources_res->size()); std::error_code ec; const auto canonical_root = std::filesystem::weakly_canonical(options.project_root, ec); @@ -374,9 +490,30 @@ compile_descriptor(const FrontendOptions &options) { host_cxx = *resolved; } - auto host_hash = Util::sha256_file_hex(host_cxx); + // Memoized hashing: identity inputs are re-hashed only when their stat fingerprint changes. + FileHashMemo hash_memo{config_dir / "identity_cache.json"}; + const auto memoized_hash = + [&](const std::filesystem::path &path) -> std::optional { + const auto fingerprint = stat_fingerprint(path); + if (fingerprint) { + if (auto cached = hash_memo.lookup(path, *fingerprint)) { + return cached; + } + } + auto hash = Util::sha256_file_hex(path); + if (!hash) { + return std::nullopt; + } + if (fingerprint) { + hash_memo.store(path, *fingerprint, *hash); + } + return *hash; + }; + + auto host_hash = memoized_hash(host_cxx); if (!host_hash) { - return std::unexpected{host_hash.error()}; + return std::unexpected{ + make_error(std::format("cannot hash host compiler '{}'", host_cxx.string()))}; } const bool has_profiles = @@ -398,33 +535,59 @@ compile_descriptor(const FrontendOptions &options) { id_hasher.update_length_prefixed(*host_hash); id_hasher.update_length_prefixed(driver_src); if (!options.sdk_include_dir.empty()) { - if (auto hdr_h = Util::sha256_file_hex(options.sdk_include_dir / "Void" / "Build.hpp"); - hdr_h) { + if (auto hdr_h = memoized_hash(options.sdk_include_dir / "Void" / "Build.hpp"); hdr_h) { id_hasher.update_length_prefixed(*hdr_h); } } if (!options.sdk_library_path.empty() && std::filesystem::exists(options.sdk_library_path, ec)) { - if (auto lib_h = Util::sha256_file_hex(options.sdk_library_path); lib_h) { + if (auto lib_h = memoized_hash(options.sdk_library_path); lib_h) { id_hasher.update_length_prefixed(*lib_h); } } for (const auto &src : *sources_res) { - auto h = Util::sha256_file_hex(src); + auto h = memoized_hash(src); if (!h) { - return std::unexpected{h.error()}; + return std::unexpected{ + make_error(std::format("cannot hash configuration source '{}'", src.string()))}; } id_hasher.update_length_prefixed(src.string()); id_hasher.update_length_prefixed(*h); } const std::string seed_id = id_hasher.finalize_hex(); + hash_memo.flush(); + Void::Log::debug("Config", "descriptor identity hashed in {:.1f} ms", phase_sw.elapsed_ms()); const auto exe_path = config_dir / ("descriptor_" + seed_id.substr(0, 16)); const auto meta_path = config_dir / ("descriptor_" + seed_id.substr(0, 16) + ".headers.json"); // Check if cached descriptor executable exists AND all previously discovered headers match! + // Header entries carry a stat fingerprint (size + mtime) beside the SHA-256: when the + // fingerprint is unchanged the content hash is trusted and no file is read. Legacy entries + // (plain hash strings) are still accepted and upgraded in place. + struct HeaderMeta { + std::string sha256; + HeaderFingerprint fingerprint; + }; bool up_to_date = false; + bool metadata_stale = false; std::vector cached_headers; + std::map> verified_headers; + const auto write_meta = [&](const std::map> &headers) { + std::string meta_json = "{\"seed_id\":" + Util::json_quote(seed_id) + ",\"headers\":{"; + bool first = true; + for (const auto &[hpath, meta] : headers) { + if (!first) { + meta_json += ','; + } + first = false; + meta_json += Util::json_quote(hpath) + ":{\"sha256\":" + Util::json_quote(meta.sha256) + + ",\"size\":" + std::to_string(meta.fingerprint.size) + + ",\"mtime\":" + std::to_string(meta.fingerprint.mtime) + '}'; + } + meta_json += "}}\n"; + (void)Platform::atomic_write_file(meta_path, meta_json, false); + }; if (std::filesystem::is_regular_file(exe_path, ec) && std::filesystem::is_regular_file(meta_path, ec)) { if (auto meta_text = Void::FileSystem::read_file(meta_path); meta_text) { @@ -435,13 +598,44 @@ compile_descriptor(const FrontendOptions &options) { if (const auto *hv = find_key(*obj, "headers")) { if (const auto *hobj = std::get_if(&hv->value)) { for (const auto &[hpath, hval] : *hobj) { - const auto *expected = std::get_if(&hval.value); - auto actual = - Util::sha256_file_hex(std::filesystem::path{hpath}); - if (!expected || !actual || *actual != *expected) { + const std::filesystem::path header{hpath}; + const auto fingerprint = stat_fingerprint(header); + if (!fingerprint) { headers_ok = false; break; } + std::string expected_sha; + std::optional expected_fp; + if (const auto *sha = std::get_if(&hval.value)) { + expected_sha = *sha; // legacy entry + metadata_stale = true; + } else if (const auto *entry = + std::get_if(&hval.value)) { + expected_sha = get_str(*entry, "sha256").value_or(""); + if (const auto size = get_i64(*entry, "size"); + size && get_i64(*entry, "mtime")) { + expected_fp = + HeaderFingerprint{*size, *get_i64(*entry, "mtime")}; + } + } + std::string actual_sha = expected_sha; + if (expected_fp && *expected_fp == *fingerprint && + !expected_sha.empty()) { + // Unchanged stat fingerprint: trust the stored hash. + } else { + auto hashed = Util::sha256_file_hex(header); + if (!hashed || (expected_sha.empty() && !expected_fp)) { + headers_ok = false; + break; + } + if (!expected_sha.empty() && *hashed != expected_sha) { + headers_ok = false; + break; + } + actual_sha = std::move(*hashed); + metadata_stale = true; + } + verified_headers[hpath] = HeaderMeta{actual_sha, *fingerprint}; cached_headers.emplace_back(hpath); } } @@ -452,6 +646,11 @@ compile_descriptor(const FrontendOptions &options) { } } } + if (up_to_date && metadata_stale) { + write_meta(verified_headers); + } + Void::Log::debug("Config", "descriptor check: seed identity + cache in {:.1f} ms", + phase_sw.elapsed_ms()); if (up_to_date) { CompiledDescriptor desc; @@ -563,20 +762,15 @@ compile_descriptor(const FrontendOptions &options) { return std::unexpected{make_error("failed publishing compiled descriptor executable")}; } - // Persist discovered header hashes atomically. - std::string meta_json = "{\"seed_id\":" + Util::json_quote(seed_id) + ",\"headers\":{"; - bool first = true; + // Persist discovered header hashes (with stat fingerprints) atomically. + std::map> persisted_headers; std::vector headers_list; for (const auto &[hpath, hsha] : header_hashes) { - if (!first) { - meta_json += ','; - } - first = false; - meta_json += Util::json_quote(hpath) + ':' + Util::json_quote(hsha); + const auto fingerprint = stat_fingerprint(hpath); + persisted_headers[hpath] = HeaderMeta{hsha, fingerprint.value_or(HeaderFingerprint{})}; headers_list.emplace_back(hpath); } - meta_json += "}}\n"; - (void)Platform::atomic_write_file(meta_path, meta_json, false); + write_meta(persisted_headers); CompiledDescriptor desc; desc.executable_path = exe_path; diff --git a/src/Editor/CompDb.cpp b/src/Editor/CompDb.cpp index f204cda..d47f700 100644 --- a/src/Editor/CompDb.cpp +++ b/src/Editor/CompDb.cpp @@ -1212,6 +1212,7 @@ export_ide_plugin_assets(const IdePluginOptions &options) { " \"categories\": [\"Other\"],\n" " \"activationEvents\": [],\n" " \"main\": \"./extension.js\",\n" + " \"scripts\": {\"test\": \"node test/extension.test.js\"},\n" " \"contributes\": {\n \"commands\": " + json_array(commands, [](const PluginCommand &command) { @@ -1232,7 +1233,8 @@ export_ide_plugin_assets(const IdePluginOptions &options) { " const terminal = vscode.window.createTerminal({ name });\n" " terminal.show(true);\n" " const full = [...args, ...projectArgs()];\n" - " terminal.sendText([vbs, ...full].map((a) => (a.includes(' ') ? `'${a}'` : a)).join(' '));\n" + " terminal.sendText([vbs, ...full].map((a) => (a.includes(' ') ? `'${a}'` : a)).join(' " + "'));\n" "}\n\n" "const commands = [\n"; for (const auto &command : commands) { @@ -1249,6 +1251,51 @@ export_ide_plugin_assets(const IdePluginOptions &options) { "function deactivate() {}\n\n" "module.exports = { activate, deactivate };\n"; + // Executes the extension against a mocked VS Code API (`npm test`). + const std::string vscode_test_js = + std::string{} + + R"js(// Generated by `vbs ide plugin`: runs extension.js against a mocked VS Code API. +const Module = require('module'); +const registered = new Map(); +const terminals = []; +const workspace = '/tmp/vbs-workspace'; +const vscodeMock = { + window: { + createTerminal: ({ name }) => ({ + name, + show() {}, + sendText(text) { terminals.push({ name, text }); }, + }), + }, + commands: { + registerCommand: (id, fn) => { registered.set(id, fn); return { dispose() {} }; }, + }, + workspace: { workspaceFolders: [{ uri: { fsPath: workspace } }] }, +}; +const originalLoad = Module._load; +Module._load = function (request) { + if (request === 'vscode') return vscodeMock; + return originalLoad.apply(this, arguments); +}; +const extension = require('../extension.js'); +extension.activate({ subscriptions: [] }); +for (const [, fn] of registered) fn(); +)js" + + "const expectedCommands = " + std::to_string(commands.size()) + ";\n" + + R"js(if (registered.size !== expectedCommands) + throw new Error('expected ' + expectedCommands + ' commands, got ' + registered.size); +if (terminals.length !== registered.size) throw new Error('every command must open a terminal'); +const build = terminals.find((t) => t.name === 'VBS: Build'); +if (!build) throw new Error('build command missing'); +if (!build.text.includes('build')) throw new Error('build args missing: ' + build.text); +if (!build.text.includes('--project ' + workspace)) + throw new Error('workspace project not injected: ' + build.text); +const install = terminals.find((t) => t.name === 'VBS: Install'); +if (!install || !install.text.includes('--prefix')) throw new Error('install prefix missing'); +extension.deactivate(); +console.log('extension tests passed: ' + terminals.length + ' commands'); +)js"; + const std::string readme = std::format( "# VoidBuildSystem editor extension\n\n" "Generated by `vbs ide plugin` for the project at `{}`.\n\n" @@ -1295,8 +1342,8 @@ export_ide_plugin_assets(const IdePluginOptions &options) { for (const auto &[name, content] : std::vector>{{"extension.toml", zed_manifest}, - {"tasks.json", zed_tasks}, - {"README.md", zed_readme}}) { + {"tasks.json", zed_tasks}, + {"README.md", zed_readme}}) { if (auto written = write_asset(output / name, content); !written) { return std::unexpected{written.error()}; } @@ -1309,7 +1356,8 @@ export_ide_plugin_assets(const IdePluginOptions &options) { " com.faumaray.vbs\n" " VoidBuildSystem\n" " Void\n" - " Build, test, install and package with VoidBuildSystem (VBS).\n" + " Build, test, install and package with VoidBuildSystem " + "(VBS).\n" " com.intellij.modules.platform\n" " com.intellij.modules.cidr.lang\n" " \n" @@ -1319,7 +1367,8 @@ export_ide_plugin_assets(const IdePluginOptions &options) { " \n" " \n" - " \n" + " \n" " \n" " \n" "\n"; @@ -1363,7 +1412,8 @@ export_ide_plugin_assets(const IdePluginOptions &options) { "class InstallAction : AnAction(\"VBS: Install\") {\n" " override fun actionPerformed(event: AnActionEvent) {\n" " event.project?.let {\n" - " runVbs(it, \"install\", listOf(\"install\", \"--prefix\", \"build/install\"))\n" + " runVbs(it, \"install\", listOf(\"install\", \"--prefix\", " + "\"build/install\"))\n" " }\n" " }\n" "}\n"; @@ -1371,11 +1421,11 @@ export_ide_plugin_assets(const IdePluginOptions &options) { "# VbsCLion\n\nCLion (JetBrains) plugin assets for VoidBuildSystem, generated by " "`vbs ide plugin --editor clion`.\n\nCLion can also read the CMake File API document " "emitted by `vbs ide generate`, so this plugin is complementary: it adds Tools-menu " - "actions for `vbs build` and `vbs install`.\n\n```sh\n./gradlew buildPlugin\n```\n\nSet " + "actions for `vbs build` and `vbs install`.\n\n```sh\n./gradlew " + "buildPlugin\n```\n\nSet " "`VBS_BIN` if `vbs` is not on `PATH`.\n"; - for (const auto &[name, content] : - std::vector>{ + for (const auto &[name, content] : std::vector>{ {"src/main/resources/META-INF/plugin.xml", plugin_xml}, {"build.gradle.kts", gradle}, {"src/main/kotlin/com/faumaray/vbs/VbsActions.kt", action_kt}, @@ -1392,10 +1442,11 @@ export_ide_plugin_assets(const IdePluginOptions &options) { "editor plugin assets are generated for vscode, zed and clion only")}; } - for (const auto &[name, content] : - std::vector>{{"package.json", package_json}, - {"extension.js", extension_js}, - {"README.md", readme}}) { + for (const auto &[name, content] : std::vector>{ + {"package.json", package_json}, + {"extension.js", extension_js}, + {"test/extension.test.js", vscode_test_js}, + {"README.md", readme}}) { if (auto written = write_asset(output / name, content); !written) { return std::unexpected{written.error()}; } diff --git a/tests/FullV1Tests.cpp b/tests/FullV1Tests.cpp index 2a7d327..e033944 100644 --- a/tests/FullV1Tests.cpp +++ b/tests/FullV1Tests.cpp @@ -1133,9 +1133,11 @@ VOID_TEST(FullV1Tests, ide_plugin_assets_export_vscode_extension) { auto report = Editor::generate_ide_plugin_assets(options); Void::Testing::require(report.has_value()); - Void::Testing::expect_eq(report->written_files.size(), std::size_t{3}); + Void::Testing::expect_eq(report->written_files.size(), std::size_t{4}); Void::Testing::expect(std::filesystem::exists(options.output_dir / "package.json")); Void::Testing::expect(std::filesystem::exists(options.output_dir / "extension.js")); + Void::Testing::expect( + std::filesystem::exists(options.output_dir / "test" / "extension.test.js")); Void::Testing::expect(std::filesystem::exists(options.output_dir / "README.md")); auto manifest_text = Void::FileSystem::read_file(options.output_dir / "package.json"); @@ -1163,6 +1165,13 @@ VOID_TEST(FullV1Tests, ide_plugin_assets_export_vscode_extension) { Void::Testing::expect(extension_text->find("vbs.build") != std::string::npos); Void::Testing::expect(extension_text->find("vbs.package") != std::string::npos); + auto test_text = Void::FileSystem::read_file(options.output_dir / "test" / "extension.test.js"); + Void::Testing::require(test_text.has_value()); + Void::Testing::expect(test_text->find("createTerminal") != std::string::npos); + Void::Testing::expect(test_text->find("const expectedCommands = 6;") != std::string::npos); + Void::Testing::expect(manifest_text->find("\"test\": \"node test/extension.test.js\"") != + std::string::npos); + auto zed_options = options; zed_options.editor = Editor::IdeKind::Zed; zed_options.output_dir = tmp / "vbs-zed";