-
-
Notifications
You must be signed in to change notification settings - Fork 84
Add Browser platform support to OS enum and RunOn/ExcludeOn attributes with WebAssembly compatibility fixes #2965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@copilot Fix any build errors and warnings from the new platform |
Fixed all build errors and warnings from the new browser platform support in commit c190643. The issues were caused by Console and Threading APIs that aren't supported on WebAssembly/browser platforms:
All changes maintain backward compatibility with .NET Standard 2.0 while properly supporting the browser platform. |
c190643
to
bca3547
Compare
Claude finished @Copilot's task —— View job PR Code ReviewReview Checklist
Code Quality & Implementation Patterns ✅Excellent architectural consistency: The implementation follows TUnit's existing patterns perfectly:
Documentation & Examples: Comprehensive XML documentation with practical examples showing all usage patterns (single platform, combined platforms, exclusion scenarios). WebAssembly Compatibility Fixes: Smart platform-specific guards implemented correctly:
The conditional compilation approach using Potential Bugs & Logic Issues ✅Critical Bug Fix Identified: The most important change in this PR is the fix in Platform Detection Logic: Both
Framework Compatibility: Proper handling of .NET Standard 2.0 vs .NET 5+ differences using conditional compilation. Performance Considerations ✅Minimal Performance Impact: The changes are primarily compile-time (conditional compilation) with minimal runtime overhead:
Smart Fallback Strategy: Efficient Color Handling: Security Considerations ✅No Security Concerns: The changes are purely platform detection and compatibility improvements without introducing any security risks:
The browser platform support actually improves security by providing proper sandboxed execution environment detection. Test Coverage Assessment ✅Comprehensive Test Scenarios:
Test Logic Soundness: Tests correctly verify platform behavior using Coverage Completeness: All major usage patterns are covered, though additional edge case testing could be valuable (combining Browser with other OS flags in complex scenarios). TUnit Development Guidelines Compliance ✅Perfect Adherence to Standards: This PR exemplifies TUnit's development principles:
Architectural Consistency: Changes integrate seamlessly with existing TUnit infrastructure without breaking existing patterns or introducing technical debt. Overall Assessment ⭐Excellent Implementation: This PR delivers high-quality browser platform support while fixing a critical logic bug in Key Strengths:
Recommendation: APPROVE - This PR is ready for merge and represents a significant improvement to TUnit's platform support capabilities. |
Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
…APIs Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
bca3547
to
6c56c91
Compare
This PR adds support for the Browser platform (WebAssembly) to TUnit's operating system constraints framework and resolves compatibility issues that arise when targeting browser platforms.
Changes Made
1. OS Enum Enhancement
Added
Browser = 8
to theOS
flags enum inTUnit.Core/Enums/OS.cs
:2. Platform Support Declaration
Added
<SupportedPlatform Include="browser" />
toLibrary.props
as requested in the issue.3. Runtime Detection
Implemented Browser platform detection in both
RunOnAttribute
andExcludeOnAttribute
usingSystem.OperatingSystem.IsBrowser()
for .NET 5+ frameworks:4. Bug Fix
Fixed a critical logic error in
ExcludeOnAttribute
that was causing all tests to be skipped due to an erroneous|| true
condition at the end of the boolean expression.5. WebAssembly Compatibility Fixes
Resolved build errors and warnings that surfaced after adding browser platform support by implementing platform-specific guards for APIs not supported on WebAssembly:
!OperatingSystem.IsBrowser()
checks using conditional compilation for .NET Standard 2.0 compatibility6. Testing and Documentation
RunOnSkipTests.cs
Usage Examples
The implementation maintains backward compatibility and follows TUnit's existing architectural patterns for platform detection while properly handling WebAssembly runtime limitations.
Fixes #2964.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.