Skip to content

Commit

Permalink
Merge pull request #472 from bUnit-dev/release/v1.2
Browse files Browse the repository at this point in the history
Release of new minor version v1.2
  • Loading branch information
egil authored Aug 9, 2021
2 parents 57dde0f + 69ccac7 commit 2f0bef1
Show file tree
Hide file tree
Showing 101 changed files with 1,870 additions and 372 deletions.
54 changes: 0 additions & 54 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -420,27 +420,6 @@ dotnet_diagnostic.CA1707.severity = error # https://github.com/atc-net
dotnet_diagnostic.CA2007.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA2007.md


# SecurityCodeScan
# https://security-code-scan.github.io/


# StyleCop
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
dotnet_diagnostic.SA1009.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1009.md
dotnet_diagnostic.SA1101.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1101.md
dotnet_diagnostic.SA1122.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1122.md
dotnet_diagnostic.SA1133.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1133.md
dotnet_diagnostic.SA1200.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1200.md
dotnet_diagnostic.SA1201.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1201.md
dotnet_diagnostic.SA1204.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1204.md
dotnet_diagnostic.SA1413.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1413.md
dotnet_diagnostic.SA1600.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1600.md
dotnet_diagnostic.SA1602.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1602.md
dotnet_diagnostic.SA1604.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1604.md
dotnet_diagnostic.SA1623.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1623.md
dotnet_diagnostic.SA1633.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1633.md


# SonarAnalyzer.CSharp
# https://rules.sonarsource.com/csharp
dotnet_diagnostic.S1135.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/SonarAnalyzerCSharp/S1135.md
Expand All @@ -467,31 +446,6 @@ dotnet_diagnostic.CA1031.severity = suggestion # CA1031: Do not catch general ex
dotnet_diagnostic.CA1032.severity = none # CA1032: Implement standard exception constructors
dotnet_diagnostic.CA2201.severity = suggestion # CA2201: Do not raise reserved exception types

# StyleCop
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
dotnet_diagnostic.SA1000.severity = none # BUGGY with C#9 code
dotnet_diagnostic.SA1005.severity = none # SA1005: Single line comments should begin with single space
dotnet_diagnostic.SA1011.severity = none # BUGGY with C#9 code

dotnet_diagnostic.SA1107.severity = suggestion # SA1107: Code should not contain multiple statements on one line
dotnet_diagnostic.SA1127.severity = suggestion # SA1127: Generic type constraints should be on their own line
dotnet_diagnostic.SA1128.severity = suggestion # SA1128: Put constructor initializers on their own line
dotnet_diagnostic.SA1133.severity = none # SA1133: Do not combine attributes
dotnet_diagnostic.SA1134.severity = none # SA1134: Attributes should not share line
dotnet_diagnostic.SA1202.severity = none # SA1202: Elements should be ordered by access
dotnet_diagnostic.SA1204.severity = none # SA1204: Static elements should appear before instance elements
dotnet_diagnostic.SA1201.severity = none # SA1201: Elements should appear in the correct order
dotnet_diagnostic.SA1404.severity = none # SA1404: Code analysis suppression should have justification
dotnet_diagnostic.SA1502.severity = none # SA1502: Element should not be on a single line
dotnet_diagnostic.SA1503.severity = none # SA1503: Braces should not be omitted
dotnet_diagnostic.SA1512.severity = none # SA1512: Single-line comments should not be followed by blank line
dotnet_diagnostic.SA1611.severity = silent # SA1611: Element parameters should be documented
dotnet_diagnostic.SA1515.severity = none # SA1515: Single-line comment should be preceded by blank line
dotnet_diagnostic.SA1516.severity = none # SA1516: Elements should be separated by blank line
dotnet_diagnostic.SA1615.severity = silent # SA1615: Element return value should be documented
dotnet_diagnostic.SA1618.severity = silent # SA1618: Generic type parameters should be documented
dotnet_diagnostic.SA1629.severity = suggestion # SA1629: Documentation text should end with a period

# SonarAnalyzer.CSharp
# https://rules.sonarsource.com/csharp
dotnet_diagnostic.S112.severity = none # S112: General exceptions should never be thrown
Expand Down Expand Up @@ -541,14 +495,6 @@ dotnet_diagnostic.CA1031.severity = none # CA1031: Do not catch general exceptio
dotnet_diagnostic.CA2012.severity = none # CA2012: Use ValueTasks correctly
dotnet_diagnostic.CA2201.severity = none # CA2201: Do not raise reserved exception types

# StyleCop
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
dotnet_diagnostic.SA0001.severity = none # SA0001: Xml Comment Analysis Disabled
dotnet_diagnostic.SA1107.severity = none # SA1107: Code should not contain multiple statements on one line
dotnet_diagnostic.SA1402.severity = none # SA1402: File may only contain a single type
dotnet_diagnostic.SA1601.severity = none # SA1601: Partial elements should be documented
dotnet_diagnostic.SA1649.severity = none # SA1649: File name should match first type name

# SonarAnalyzer.CSharp
# https://rules.sonarsource.com/csharp
dotnet_diagnostic.S125.severity = none # S125: Sections of code should not be commented out
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/docs-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ jobs:
- name: ⚙️ Setup dotnet 6.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.100-preview.3.21202.5'
dotnet-version: 6.0.x
include-prerelease: true

- name: 🛠️ Building bUnit
run: dotnet build /p:PublicRelease=true
Expand Down Expand Up @@ -102,13 +103,15 @@ jobs:
GH_PAT: ${{ secrets.BUNIT_BOT_TOKEN }}

- name: ⏩ Merge stable with main, push origin
id: mergeMainline
continue-on-error: true
run: |
git checkout main
git merge -S stable
git push origin main
- name: ⏭ Create pull request from stable to main when direct merge fails
if: ${{ failure() }}
if: steps.mergeMainline.outcome == 'failure'
uses: thomaseizinger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.BUNIT_BOT_TOKEN }}
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ on:
types: [ completed ]

workflow_dispatch:
inputs:
nugetRelease:
description: 'Release to NuGet? Set to "true" to release to NuGet.org as well as GPR.'
required: true
default: 'false'

jobs:
release-preview:
if: github.ref == 'refs/heads/main' || ${{ github.event.workflow_run.conclusion == 'success' }}
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' && ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:

Expand All @@ -31,7 +36,8 @@ jobs:
- name: ⚙️ Setup dotnet 6.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.100-preview.3.21202.5'
dotnet-version: 6.0.x
include-prerelease: true

- name: 🛠️ Update tokens in project files
uses: cschleiden/replace-tokens@v1
Expand All @@ -40,9 +46,13 @@ jobs:

- name: 🛠️ Packing library in release mode
run: |
dotnet pack -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
dotnet pack src/bunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
dotnet pack src/bunit.template/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
dotnet pack -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true
dotnet pack src/bunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true
dotnet pack src/bunit.template/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true
- name: 🛠️ Upload library to GitHub Package Repository
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/bunit-dev/index.json --skip-duplicate --no-symbols true

- name: 🛠️ Upload library to NuGet.org repository
if: github.event.inputs.nugetRelease == 'true'
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols true
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ jobs:
- name: ⚙️ Setup dotnet 6.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.100-preview.3.21202.5'
dotnet-version: 6.0.x
include-prerelease: true

- name: 🛠️ Update changelog
uses: thomaseizinger/[email protected]
Expand Down Expand Up @@ -110,7 +111,7 @@ jobs:
with:
tag_name: v${{ env.NBGV_SemVer2 }}
target_commitish: ${{ env.RELEASE_COMMIT_HASH }}
name: Release ${{ env.NBGV_SemVer2 }}
name: ${{ env.NBGV_SemVer2 }}
body: ${{ steps.changelog_reader.outputs.changes }}
draft: false
prerelease: ${{ env.NBGV_PublicRelease == 'False' }}
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, windows-latest] # macos-latest removed due to env error
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -44,7 +44,8 @@ jobs:
- name: ⚙️ Setup dotnet 6.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.100-preview.3.21202.5'
dotnet-version: 6.0.x
include-prerelease: true

- name: ⚙️ Setup GIT versioning
uses: dotnet/[email protected]
Expand All @@ -61,19 +62,16 @@ jobs:
run: dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org --configfile $env:APPDATA\NuGet\NuGet.Config
continue-on-error: true

- name: 🛠️ Build library in release mode
run: dotnet build -c release -p:ContinuousIntegrationBuild=true

- name: 🧪 Run unit tests
run: |
dotnet test ./tests/bunit.core.tests/bunit.core.tests.csproj -c release --logger GitHubActions
dotnet test ./tests/bunit.web.tests/bunit.web.tests.csproj -c release --logger GitHubActions
dotnet test ./tests/bunit.web.testcomponents.tests/bunit.web.testcomponents.tests.csproj -c release --logger GitHubActions
- name: 🗳️ Create library packages
- name: 🗳️ Pack library
run: |
dotnet pack src/bunit/ -c release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
dotnet pack -c release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
dotnet pack src/bunit/ -c release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
dotnet pack src/bunit.template/ -c release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
# Excluding windows because the restore step doesnt seem to work correct.
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,5 @@ bunit.docs/log.txt
.sonarqube
tests/*/coverage

bunit.v3.ncrunchsolution.user
bunit.v3.ncrunchsolution.user
watch.csproj
45 changes: 42 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,55 @@ All notable changes to **bUnit** will be documented in this file. The project ad

## [Unreleased]

### Added

List of added functionality in this release.

- Added more extensions methods to `MarkupMatchesAssertExtensions` to allow asserting with `MarkupMatches` on `IEnumerable` and `IElement`. By [@jgoday](https://github.com/jgoday).

- Added `BunitErrorBoundaryLogger` implementation of `IErrorBoundaryLogger` (needed for Blazor's ErrorBoundary component in .NET 6.0). By [@jgoday](https://github.com/jgoday).

- Added `ComponentFactories` property to the `TestContextBase` type. The `ComponentFactories` property is a `ComponentFactoryCollection` type that contains `IComponentFactory` types. These are used by bUnits component activator, whenever a component is created during testing. If no component factories is added to the collection, the standard component activator mechanism from Blazor is used. This feature makes it possible to control what components are created normally during a test, and which should be e.g. replaced by a test dummy. More info is available in issue [#388](https://github.com/bUnit-dev/bUnit/issues/388).

Learn more about this feature on the [Controlling component instantiation](https://bunit.dev/docs/providing-input/controlling-component-instantiation) page.

- Added `HasComponent<TComponent>()` to `IRenderedFragement`. Use it to check if the rendered fragment contains a component of type `TComponent`. Added by [@egil](https://github.com/egil).

- Added `UseStubFor` and `UseFor` extension methods to `ComponentFactories` that makes it easy to configure bUnit to replace components in the render tree with stubs. Both methods have overloads that allow for fine grained selection of component types to "double" during testing. Added by [@egil](https://github.com/egil) in [#400](https://github.com/bUnit-dev/bUnit/pull/400).

### Changed

List of changes in this release.

- Updated AngleSharp and related libraries to 0.16.0. _NOTE, the new version of AngleSharp includes nullable annotations, which might affect how your code compiles, if you have nullable checking enabled in your test project._ By [@egil](https://github.com/egil).

- Updated .NET 6 dependencies to preview 5. By [@egil](https://github.com/egil).

### Fixed

List of fixes in this release.

- Fixed JSInterop error message when trying to import an unconfigured module. By [@jgoday](https://github.com/jgoday) in [#425](https://github.com/bUnit-dev/bUnit/pull/425).

- Fixed issue where a registered fall-back service provider was not made available to resolve service dependencies of components under test. Thanks to [@dady8889](https://github.com/dady8889) for the reporting the issue.

- Fixed handling of escaped uri's in FakeNavigationManager. By [@linkdotnet](https://github.com/linkdotnet) in [#460](https://github.com/bUnit-dev/bUnit/pull/460).

- Captured error message from event dispatcher in renderer that would previously be hidden from the user. Related to issue [#399](https://github.com/bUnit-dev/bUnit/issues/399).

## [1.1.5] - 2021-04-30

### Added

- All bUnit assemblies is now strong named signed.
- Added .NET 6 (preview 3) as a target framework for bUnit, bUnit.core and bUnit.web.
- All bUnit assemblies is now strong named signed.

- Added .NET 6 (preview 3) as a target framework for bUnit, bUnit.core and bUnit.web.

### Changed

- Changed bunit.template such that created projects only reference the bunit package. Bumped other referenced packages to latest version.
- Changed bunit.template such that created projects only reference the bUnit package. Bumped other referenced packages to latest version.

- Changed TestServiceProvider to validate scopes of registered services, such that it behaves like the service provider (default IoC container) in Blazor.

## [1.0.16]

Expand Down
78 changes: 2 additions & 76 deletions CODE-OF-CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,2 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make our project and
community a harassment-free experience for everyone, regardless of age,
size, disability, ethnicity, sexuality, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, or religion.

## Our Standards

Examples of behavior that contribute towards creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to temporarily or
permanently ban any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abuse, harassment, or otherwise unacceptable behavior may be
reported by contacting the project leader at [[email protected]](mailto:[email protected]). All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community.
For more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).
Loading

0 comments on commit 2f0bef1

Please sign in to comment.