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

chore: Update xUnit related package version to v3 #10474

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

filzrev
Copy link
Contributor

@filzrev filzrev commented Dec 19, 2024

This is Draft PR to migrate unit test projects to xUnit v3. (Prev draft PR is #10375)
Currently test execution on VS is unstable

Known issues

  1. TestTfmsInParallel: false setting is not works as expected when running tests with VS Test Explorer
    (https://github.com/xunit/visualstudio.xunit/issues/429)

What's changed to this PR

1. Switch xUnit.NET related NuGet packages to v3.

  • Verify.Xunit -> Verify.XunitV3
  • xunit -> xunit.v3

2. Add additional output log types (*.log/*.ctrf)

3. Change unittest's projects OutputType from LibrarytoExeand Exolicitly setIsTestProject` property

4. Add Microsoft.Testing.Platform related settings
Microsoft.Testing.Platform is alternative unit test execution layers.

6. Add xunit.runner.json config file for test project.

7. Pass TestContext.Current.CancellationToken that require Cancellation token.

8. Modify MetadataCommandTest.cs And add steps to create dummy Directory.Build.props file.
It's required to ignore project directories Directory.Build.props settings

9. Add empty Directory.Build.props file to samples directory

10. Modify CI workflow to use custom seed value to reproduce issue on CI
By default. xUnit determine seed on build time and seed value is different between assemblies.
So to fix seed value. Use github.run_number as a seed value. (It's incremented from 1)

If CI failed by parallel execution related issue.
It can re-run job with using same seed.

11. Add SetBranchNameAttribute that derived from BeforeAfterTestAttribute
When running SeedMarkdown tests before other snapshot tests.
It cause snapshot diffs because GitUtility.cs caching actual branch name.
To simplify environment variable set/restore.
Add custom BeforeAfterTestAttribute for this purpose.

12. Add [assembly:CaptureConsole] attribute to test assemblies.

13. Add ProcessHelper class to invoke external command (e.g. dotnet, docfx).
When using Process.Start to launch external command that stdout.
Running tests is not completed when running tests on Test Explorer.
So I've added utility code to ignoring stdout/stdout.

15. Modify dotnet test --filter Stage=Percy command. to use -- --filter-trait "Stage=Percy"
When TestingPlatformDotnetTestSupport is enabled. dotnet test command's --filter argument is silently ignored. (Same behavior as that reported at https://github.com/microsoft/testfx/issues/4401)
It need modify command to pass additional argument(-- --filter-trait "Stage=Percy")

16. Separate Chromium Headless Shell installation from test steps
Chromium is installed on when running docfx pdf command first time.
It take times and it affects test execution times.
So creating separate chromium install step that is executed before running dotnet test.

https://github.com/dotnet/docfx/pull/10474/files#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fR43-R48

17. Add -nodereuse:false and --no-dependencies parameter to dotnet build command inside tests
After migrated to xUnit v3.
SamplesTest::Extensions dotnet build command takes extra 15 minutes on Windows CI.
It seems relating to https://github.com/dotnet/sdk/issues/9452 so I've added -nodereuse:false parameter to resolve issue.
And adding --no-dependencies parameter to suppress Docfx.App project build during test.

**18. Add dotnet-coverage command related settings.
Currently Microsoft.Testing.Platform don't support coveret-based codecoverage with dotnet test command.

@filzrev filzrev force-pushed the chore-update-xunit-to-v3 branch 9 times, most recently from 115da34 to 29128a9 Compare December 21, 2024 21:56
@filzrev filzrev force-pushed the chore-update-xunit-to-v3 branch 2 times, most recently from 36241e0 to ff545e2 Compare December 27, 2024 00:16
@filzrev filzrev force-pushed the chore-update-xunit-to-v3 branch 5 times, most recently from 2626bc2 to 7b78733 Compare February 17, 2025 06:31
filzrev and others added 9 commits February 18, 2025 22:10
* deps: update dependencies

* chore: fix ci error of plantuml test
* docs: fix nightly build install steps

* chore: fix ci error of plantuml test
…#10540)

* feat: add `.slnx` solution format (Requires .NET 9 or later)

* chore: fix ci error of plantuml test
* chore: modify regex settings

* chore: fix ci error of plantuml test
chore: fix ci error of plantuml test
…#10546)

Bumps [dompurify](https://github.com/cure53/DOMPurify) from 3.2.1 to 3.2.4.
- [Release notes](https://github.com/cure53/DOMPurify/releases)
- [Commits](cure53/DOMPurify@3.2.1...3.2.4)

---
updated-dependencies:
- dependency-name: dompurify
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…with 2 updates (dotnet#10547)

Bumps the typescript-eslint group with 2 updates in the /templates directory: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser).


Updates `@typescript-eslint/eslint-plugin` from 8.24.0 to 8.24.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.24.1/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 8.24.0 to 8.24.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.24.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: typescript-eslint
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: typescript-eslint
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…mpilations (dotnet#10491)

* Use provided references for search for dependencies in AssemblyCompilation
+ small code duplication cleanup

* Added code to warning

* Fixes whitespace

---------

Co-authored-by: Yufei Huang <[email protected]>
@filzrev filzrev force-pushed the chore-update-xunit-to-v3 branch from 1d92161 to 313a6bb Compare February 18, 2025 13:11
@filzrev filzrev force-pushed the chore-update-xunit-to-v3 branch from 313a6bb to f0500b4 Compare February 18, 2025 22:35
@filzrev filzrev force-pushed the chore-update-xunit-to-v3 branch from f0500b4 to 6dc0d98 Compare February 19, 2025 13:03
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.

2 participants