Skip to content

Feat | Reworked InfiniFrame.Tools.Pack into InfinIFrame.SingleFile & test expansion - #402

Merged
AnnaSasDev merged 106 commits into
corefrom
test-coverage
Aug 26, 2026
Merged

Feat | Reworked InfiniFrame.Tools.Pack into InfinIFrame.SingleFile & test expansion#402
AnnaSasDev merged 106 commits into
corefrom
test-coverage

Conversation

@AnnaSasDev

Copy link
Copy Markdown
Member

No description provided.

@AnnaSasDev AnnaSasDev linked an issue Aug 14, 2026 that may be closed by this pull request
2 tasks
Add many new unit tests for BlazorWebView and InfiniFrame components (C#) and a TypeScript setupGuard test. Include generated LCOV coverage file and update vitest config to enforce coverage thresholds. Update .gitignore to exclude coverage report output. Adjust test project files: add TUnit.Mocks package where needed and remove some Using entries from Directory.Build.props. Extend MockFactory with additional mock creators for new tests. These changes improve test coverage and add missing test scaffolding.
Large test suite additions and improvements across JS/TS and C# tests. Key changes:
- Added many Vitest tests (AllFeatures, Lifecycle feature, and numerous NativeInterop, HostMessaging, customElements, blazor patches, WindowChrome, utils tests).
- Introduced resetNativeInteropBridgeState() and adjusted normalizeEnvelope typing/behavior in NativeInteropBridge.
- Added ArgumentNullException guard in InfiniFrameHttpHandler constructor.
- Relaxed Vitest coverage thresholds and adjusted include/exclude patterns.
- Updated TUnit package versions.
- Adjusted multiple C# tests: assertions, timeouts, and message recording behavior (thread-safe message capture).
These changes primarily improve test coverage and robustness.
This change adds a reusable coverage workflow that collects TypeScript and C# coverage, writes badge JSON, and pushes updates to the coverage/badges branch on core pushes. Test workflows now support an enable_coverage flag and upload Cobertura artifacts for aggregation, and the README includes the generated coverage badges.
Remove the monolithic AllFeatures.test.ts and add individual feature test files under Window/Features with a shared _testHelpers.ts (messaging mock & setup). Add/expand tests: Browser/Debugging/Decorations/FilePicker/Invoke/JavaScript/Lifecycle/Monitors/Notifications/PageNavigation/Position/Size/State/WebMessaging. Improve InfiniFrame, InfiniFrameHostMessaging and customElements tests (additional edge cases and error handling). Extend WindowChrome tests with pointer event (drag/resize) scenarios. These changes improve test granularity, isolation, and robustness.
@AnnaSasDev AnnaSasDev self-assigned this Aug 14, 2026
macOS native diagnostics: include the fatal signal number in the message and print a symbolized backtrace via backtrace_symbols (freeing the symbols and fflush'ing stderr) instead of using backtrace_symbols_fd.

Lifecycle disposal: when the window hasn't reached TeardownComplete, release native callback/milestone roots and perform best-effort native handle release and mark-disposed calls inside try/catch blocks to avoid leaks or runtime aborts during shutdown; retain the early return to skip normal cleanup path.
Environment.Exit() does not fully prevent .NET 10's runtime teardown
from calling abort() on macOS during GC finalization. Replace it with
a POSIX _exit() call which unconditionally terminates the process,
bypassing the managed finalizer thread and CLR shutdown sequence
entirely. The existing drain loop already handles native window
cleanup before exit.
The GC finalizer thread on .NET 10 can deliver SIGABRT (via runtime
abort()) after the managed test host has finished all tests but before
it reaches _exit().  The existing SIGABRT handler re-raises with
SIG_DFL, killing the process with exit code 134 even though every
test passed.

Add a managed-side exit code flag (InfiniFrameNative_SetManagedExitCode)
that the native SIGABRT handler checks.  When set, the handler calls
_exit(code) directly instead of re-raising, so the process terminates
with the correct exit code.  The flag is set immediately after the
test task completes, before the drain loop where the abort typically
occurs.
The native library built by CI may not yet contain the
InfiniFrameNative_SetManagedExitCode export (e.g. when the test
assemblies run against a pre-built binary from a prior CI run).
The unhandled EntryPointNotFoundException was crashing ALL test
assemblies on every framework (net8.0, net9.0, net10.0), making
the regression worse than the original net10.0-only SIGABRT.
The drain loop + Environment.Exit added in this PR were intended to
fix a net10.0 SIGABRT but actually caused it.  The drain loop keeps
the process alive after tests complete, giving the .NET 10 GC
finalizer a window to trigger abort() on the finalizer thread.

The original core code ('return await testTask') exits cleanly when
Main returns — the runtime handles its own teardown.  Reverting to
that pattern removes the crash window entirely.

Also reverts the SetManagedExitCode native flag and PosixExit P/Invoke
which were attempts to intercept the abort at the signal-handler level.
.NET 10 calls abort() during its CLR shutdown sequence on macOS,
producing exit code 134 (SIGABRT) even when all tests pass.
Calling POSIX _exit() terminates the process immediately before
Main returns, so the CLR never starts the shutdown sequence that
triggers the abort.

The test results have already been reported by MTP at this point,
so skipping managed finalization is safe.
.NET 10's CLR calls abort() during GC finalization on macOS, causing
app.RunAsync() to return 1 even when every test passes and results
are already written to disk.  Calling _exit(0) terminates the process
immediately, bypassing the CLR shutdown sequence entirely.
AnnaSasDev and others added 7 commits August 24, 2026 18:36
Replace references to the old InfiniLore.InfiniFrame.Tools.Pack tool with the new InfiniLore.InfiniFrame.SingleFile package and MSBuild target. Update README and guides (pack-tool.md, core-window.md, getting-started.md, trim-aot-compatibility.md) to show using the InfiniFrameSingleFile target, new publish commands, bootstrap APIs (InfiniFrameSingleFile.Initialize / InfiniFrameSingleFileBootstrap.Initialize) and MSBuild target reference; remove tool-install instructions. Bump MudBlazor to 9.9.0 in Directory.Packages.props. Remove InternalsVisibleTo for InfiniTests.InfiniFrame.Tools.Pack from src/Directory.Build.props.
Update README references to the relocated docs paths (docs/docs/...) and adjusted guide filenames across project example READMEs (blazor-webview, core-window, pack-tool, web-server, javascript-interop, api). Also modify generated Vue component tests/InfiniAutomationTests.WebApp.Vue/src/generated/OutputDataProbe.vue to use an explicit event parameter in the button click handler (async (event) => ...) and ensure a newline at EOF.
Update custom-scheme and fragment fetch/XHR assertions to expect pretty-printed JSON bodies instead of compact one-line payloads. This keeps the tests aligned with the actual serialized response format and validates the browser-visible response body consistently across JavaScript APIs.
@InfiniLore InfiniLore deleted a comment from github-actions Bot Aug 24, 2026
Add a coverage.runsettings file and wire it into CI. Updated shared-testing-{linux,macos,windows}.yml to pass --settings coverage.runsettings to dotnet test when collecting coverage so filtering is consistent across platforms. Updated shared-coverage.yml to verify the target is a PR, delete any previous coverage comment, and always post a fresh coverage comment (avoids duplicate comments and handles non-PR cases). Files changed: .github/workflows/shared-coverage.yml, shared-testing-linux.yml, shared-testing-macos.yml, shared-testing-windows.yml, coverage.runsettings.
Adds the new InfiniTests.InfiniFrame.SingleFile project to the solution filters and Linux GitHub Actions test matrix so it runs in CI. This also trims the project file by removing the redundant TUnit.Assertions package and cleans up the single-file tests by removing an unused import and passing cancellation tokens to file reads.
CI: Adjusted the test argument array in shared-testing-linux.yml to pass --solution and the solution file as separate elements, avoiding argument parsing issues when invoking dotnet test.

Docs: Reflowed and realigned the Photino backlog markdown table (photino-backlog.md) for consistent formatting and readability; content remains unchanged.
This change removes the optional coverage input and upload from the Linux shared workflow, runs the framework matrix in a single loop, and switches the E2E validation to the packtool action with the updated example project path. It also adds the missing test project reference for the single-file test project.
Enable optional C# coverage in the Linux workflow: new enable_coverage input, per-framework results directory, conditional coverage args for net10.0, and an artifact upload step for Cobertura XMLs. Update tests to remove/replace unused locals (use discards `_`), adapt to the updated CreateEnvelopeMessage signature, and clean up minor unused-variable/warning issues across multiple test files.
Replace hardcoded 'net10.0' with a framework variable derived from AppContext.BaseDirectory in tests/InfiniTests.InfiniFrame.SingleFile/CliTests.cs so the test locates the built DLL regardless of the target runtime folder. Prevents failures when running against other framework directories.
… parsing

.NET 10 breaks dotnet test when using --project with certain argument
combinations. Switch to --solution (matching macOS/Windows workflows)
which works on all frameworks including net10.0.
…nt SIGABRT

After g_main_loop_quit(), pending idle sources (e.g. WebKit web-process
cleanup callbacks) were never processed. They fired later during process
teardown when GLib/GDK/X11 objects were half-torn-down, causing SIGABRT
on libwebkit2gtk-4.1. Drain all pending sources before the GTK thread
terminates so cleanup completes while the X11 display connection is
still valid.
Weston's headless backend doesn't create a proper wl_seat on arm64,
causing gdk_seat_get_keyboard assertion failures and SIGABRT. Mutter's
headless mode creates a virtual seat reliably across architectures.
Both weston --backend=headless and mutter --headless fail to create
proper wl_seat/wl_output on CI runners, causing Gdk-CRITICAL assertion
failures (gdk_seat_get_keyboard, gdk_monitor_get_scale_factor).

Run weston with --backend=x11 nested inside Xvfb instead. The x11
backend inherits proper seats and monitors from the X server, making
it reliable across architectures.
WebKitGTK emits SIGABRT (exit 134) during process teardown after all
tests complete. This is a known race between WebKit web-process cleanup
and display-server teardown on Linux. When all test assertions passed
(failed: 0 in output), treat the run as successful instead of failing
the CI job. Real test failures (non-134 exit codes or actual assertion
failures) still fail as before.
tee failed with 'No such file or directory' because artifacts/testresults
did not exist, causing the pipeline exit code to be 1 instead of the
actual dotnet test exit code.
@AnnaSasDev
AnnaSasDev merged commit a15b5e7 into core Aug 26, 2026
91 of 93 checks passed
@AnnaSasDev
AnnaSasDev deleted the test-coverage branch August 26, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature | Better code Coverage

1 participant