Skip to content
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

fix(xunit): support netstandard2.0 #3063

Merged
merged 2 commits into from
Nov 22, 2024
Merged

fix(xunit): support netstandard2.0 #3063

merged 2 commits into from
Nov 22, 2024

Conversation

mxschmitt
Copy link
Member

@mxschmitt mxschmitt commented Nov 22, 2024

ModuleInitializer was something which was not supported in older .NET frameworks. This patch starts listening on the constructor instead and resets the TestOK status in TestInitialize.

Background: xUnit 2 does not provide a reliable way of determining if a test was passing or failing and reading it's status in the AfterEach. xUnit 3 allows to read its status which we'll use once its published. We want to support xUnit 2 as well.

#2977

{
private static readonly ConcurrentStack<Worker> _allWorkers = new();
private Worker? _currentWorker = null!;
private Worker _currentWorker = null!;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by: Similar to 7f3b888.

@kblok
Copy link
Contributor

kblok commented Nov 22, 2024

How about targeting netstandard instead?

@campersau
Copy link
Contributor

xunit.runner.visualstudio and Microsoft.NET.Test.Sdk only work with net462.
Is there a reason why these packages are referenced?

@mxschmitt mxschmitt changed the title fix(net462): support net462 fix(xunit): support netstandard2.0 Nov 22, 2024
@mxschmitt
Copy link
Member Author

How about targeting netstandard instead?

I didn't do it because of:

Playwright.Xunit.csproj : warning NU1701: Package 'xunit.runner.visualstudio 2.8.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

Since removing #3063 (comment) sounds good to me we can target netstandard2.0 now.

xunit.runner.visualstudio and Microsoft.NET.Test.Sdk only work with net462. Is there a reason why these packages are referenced?

Addressed.

Thanks both!

src/Playwright.Xunit/WorkerAwareTest.cs Outdated Show resolved Hide resolved
@mxschmitt mxschmitt merged commit c9f0914 into main Nov 22, 2024
13 of 15 checks passed
@mxschmitt mxschmitt deleted the fix/xunit-support-net462 branch November 22, 2024 16:18
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.

4 participants