Skip to content

Commit 2f0bef1

Browse files
authored
Merge pull request #472 from bUnit-dev/release/v1.2
Release of new minor version v1.2
2 parents 57dde0f + 69ccac7 commit 2f0bef1

File tree

101 files changed

+1870
-372
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+1870
-372
lines changed

.editorconfig

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -420,27 +420,6 @@ dotnet_diagnostic.CA1707.severity = error # https://github.com/atc-net
420420
dotnet_diagnostic.CA2007.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA2007.md
421421

422422

423-
# SecurityCodeScan
424-
# https://security-code-scan.github.io/
425-
426-
427-
# StyleCop
428-
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
429-
dotnet_diagnostic.SA1009.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1009.md
430-
dotnet_diagnostic.SA1101.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1101.md
431-
dotnet_diagnostic.SA1122.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1122.md
432-
dotnet_diagnostic.SA1133.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1133.md
433-
dotnet_diagnostic.SA1200.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1200.md
434-
dotnet_diagnostic.SA1201.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1201.md
435-
dotnet_diagnostic.SA1204.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1204.md
436-
dotnet_diagnostic.SA1413.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1413.md
437-
dotnet_diagnostic.SA1600.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1600.md
438-
dotnet_diagnostic.SA1602.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1602.md
439-
dotnet_diagnostic.SA1604.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1604.md
440-
dotnet_diagnostic.SA1623.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1623.md
441-
dotnet_diagnostic.SA1633.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1633.md
442-
443-
444423
# SonarAnalyzer.CSharp
445424
# https://rules.sonarsource.com/csharp
446425
dotnet_diagnostic.S1135.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/SonarAnalyzerCSharp/S1135.md
@@ -467,31 +446,6 @@ dotnet_diagnostic.CA1031.severity = suggestion # CA1031: Do not catch general ex
467446
dotnet_diagnostic.CA1032.severity = none # CA1032: Implement standard exception constructors
468447
dotnet_diagnostic.CA2201.severity = suggestion # CA2201: Do not raise reserved exception types
469448

470-
# StyleCop
471-
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
472-
dotnet_diagnostic.SA1000.severity = none # BUGGY with C#9 code
473-
dotnet_diagnostic.SA1005.severity = none # SA1005: Single line comments should begin with single space
474-
dotnet_diagnostic.SA1011.severity = none # BUGGY with C#9 code
475-
476-
dotnet_diagnostic.SA1107.severity = suggestion # SA1107: Code should not contain multiple statements on one line
477-
dotnet_diagnostic.SA1127.severity = suggestion # SA1127: Generic type constraints should be on their own line
478-
dotnet_diagnostic.SA1128.severity = suggestion # SA1128: Put constructor initializers on their own line
479-
dotnet_diagnostic.SA1133.severity = none # SA1133: Do not combine attributes
480-
dotnet_diagnostic.SA1134.severity = none # SA1134: Attributes should not share line
481-
dotnet_diagnostic.SA1202.severity = none # SA1202: Elements should be ordered by access
482-
dotnet_diagnostic.SA1204.severity = none # SA1204: Static elements should appear before instance elements
483-
dotnet_diagnostic.SA1201.severity = none # SA1201: Elements should appear in the correct order
484-
dotnet_diagnostic.SA1404.severity = none # SA1404: Code analysis suppression should have justification
485-
dotnet_diagnostic.SA1502.severity = none # SA1502: Element should not be on a single line
486-
dotnet_diagnostic.SA1503.severity = none # SA1503: Braces should not be omitted
487-
dotnet_diagnostic.SA1512.severity = none # SA1512: Single-line comments should not be followed by blank line
488-
dotnet_diagnostic.SA1611.severity = silent # SA1611: Element parameters should be documented
489-
dotnet_diagnostic.SA1515.severity = none # SA1515: Single-line comment should be preceded by blank line
490-
dotnet_diagnostic.SA1516.severity = none # SA1516: Elements should be separated by blank line
491-
dotnet_diagnostic.SA1615.severity = silent # SA1615: Element return value should be documented
492-
dotnet_diagnostic.SA1618.severity = silent # SA1618: Generic type parameters should be documented
493-
dotnet_diagnostic.SA1629.severity = suggestion # SA1629: Documentation text should end with a period
494-
495449
# SonarAnalyzer.CSharp
496450
# https://rules.sonarsource.com/csharp
497451
dotnet_diagnostic.S112.severity = none # S112: General exceptions should never be thrown
@@ -541,14 +495,6 @@ dotnet_diagnostic.CA1031.severity = none # CA1031: Do not catch general exceptio
541495
dotnet_diagnostic.CA2012.severity = none # CA2012: Use ValueTasks correctly
542496
dotnet_diagnostic.CA2201.severity = none # CA2201: Do not raise reserved exception types
543497

544-
# StyleCop
545-
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
546-
dotnet_diagnostic.SA0001.severity = none # SA0001: Xml Comment Analysis Disabled
547-
dotnet_diagnostic.SA1107.severity = none # SA1107: Code should not contain multiple statements on one line
548-
dotnet_diagnostic.SA1402.severity = none # SA1402: File may only contain a single type
549-
dotnet_diagnostic.SA1601.severity = none # SA1601: Partial elements should be documented
550-
dotnet_diagnostic.SA1649.severity = none # SA1649: File name should match first type name
551-
552498
# SonarAnalyzer.CSharp
553499
# https://rules.sonarsource.com/csharp
554500
dotnet_diagnostic.S125.severity = none # S125: Sections of code should not be commented out

.github/workflows/docs-deploy.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ jobs:
7373
- name: ⚙️ Setup dotnet 6.0.x
7474
uses: actions/setup-dotnet@v1
7575
with:
76-
dotnet-version: '6.0.100-preview.3.21202.5'
76+
dotnet-version: 6.0.x
77+
include-prerelease: true
7778

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

104105
- name: ⏩ Merge stable with main, push origin
106+
id: mergeMainline
107+
continue-on-error: true
105108
run: |
106109
git checkout main
107110
git merge -S stable
108111
git push origin main
109112
110113
- name: ⏭ Create pull request from stable to main when direct merge fails
111-
if: ${{ failure() }}
114+
if: steps.mergeMainline.outcome == 'failure'
112115
uses: thomaseizinger/[email protected]
113116
env:
114117
GITHUB_TOKEN: ${{ secrets.BUNIT_BOT_TOKEN }}

.github/workflows/release-preview.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@ on:
88
types: [ completed ]
99

1010
workflow_dispatch:
11+
inputs:
12+
nugetRelease:
13+
description: 'Release to NuGet? Set to "true" to release to NuGet.org as well as GPR.'
14+
required: true
15+
default: 'false'
1116

1217
jobs:
1318
release-preview:
14-
if: github.ref == 'refs/heads/main' || ${{ github.event.workflow_run.conclusion == 'success' }}
19+
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' && ${{ github.event.workflow_run.conclusion == 'success' }}
1520
runs-on: ubuntu-latest
1621
steps:
1722

@@ -31,7 +36,8 @@ jobs:
3136
- name: ⚙️ Setup dotnet 6.0.x
3237
uses: actions/setup-dotnet@v1
3338
with:
34-
dotnet-version: '6.0.100-preview.3.21202.5'
39+
dotnet-version: 6.0.x
40+
include-prerelease: true
3541

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

4147
- name: 🛠️ Packing library in release mode
4248
run: |
43-
dotnet pack -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
44-
dotnet pack src/bunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
45-
dotnet pack src/bunit.template/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
49+
dotnet pack -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true
50+
dotnet pack src/bunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true
51+
dotnet pack src/bunit.template/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true
4652
4753
- name: 🛠️ Upload library to GitHub Package Repository
4854
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
55+
56+
- name: 🛠️ Upload library to NuGet.org repository
57+
if: github.event.inputs.nugetRelease == 'true'
58+
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

.github/workflows/release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ jobs:
6767
- name: ⚙️ Setup dotnet 6.0.x
6868
uses: actions/setup-dotnet@v1
6969
with:
70-
dotnet-version: '6.0.100-preview.3.21202.5'
70+
dotnet-version: 6.0.x
71+
include-prerelease: true
7172

7273
- name: 🛠️ Update changelog
7374
uses: thomaseizinger/[email protected]
@@ -110,7 +111,7 @@ jobs:
110111
with:
111112
tag_name: v${{ env.NBGV_SemVer2 }}
112113
target_commitish: ${{ env.RELEASE_COMMIT_HASH }}
113-
name: Release ${{ env.NBGV_SemVer2 }}
114+
name: ${{ env.NBGV_SemVer2 }}
114115
body: ${{ steps.changelog_reader.outputs.changes }}
115116
draft: false
116117
prerelease: ${{ env.NBGV_PublicRelease == 'False' }}

.github/workflows/verification.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
os: [ubuntu-latest, macos-latest, windows-latest]
25+
os: [ubuntu-latest, windows-latest] # macos-latest removed due to env error
2626
runs-on: ${{ matrix.os }}
2727

2828
steps:
@@ -44,7 +44,8 @@ jobs:
4444
- name: ⚙️ Setup dotnet 6.0.x
4545
uses: actions/setup-dotnet@v1
4646
with:
47-
dotnet-version: '6.0.100-preview.3.21202.5'
47+
dotnet-version: 6.0.x
48+
include-prerelease: true
4849

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

64-
- name: 🛠️ Build library in release mode
65-
run: dotnet build -c release -p:ContinuousIntegrationBuild=true
66-
6765
- name: 🧪 Run unit tests
6866
run: |
6967
dotnet test ./tests/bunit.core.tests/bunit.core.tests.csproj -c release --logger GitHubActions
7068
dotnet test ./tests/bunit.web.tests/bunit.web.tests.csproj -c release --logger GitHubActions
7169
dotnet test ./tests/bunit.web.testcomponents.tests/bunit.web.testcomponents.tests.csproj -c release --logger GitHubActions
7270
73-
- name: 🗳️ Create library packages
71+
- name: 🗳️ Pack library
7472
run: |
75-
dotnet pack src/bunit/ -c release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
7673
dotnet pack -c release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
74+
dotnet pack src/bunit/ -c release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
7775
dotnet pack src/bunit.template/ -c release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
7876
7977
# Excluding windows because the restore step doesnt seem to work correct.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,4 +337,5 @@ bunit.docs/log.txt
337337
.sonarqube
338338
tests/*/coverage
339339

340-
bunit.v3.ncrunchsolution.user
340+
bunit.v3.ncrunchsolution.user
341+
watch.csproj

CHANGELOG.md

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,55 @@ All notable changes to **bUnit** will be documented in this file. The project ad
66

77
## [Unreleased]
88

9+
### Added
10+
11+
List of added functionality in this release.
12+
13+
- Added more extensions methods to `MarkupMatchesAssertExtensions` to allow asserting with `MarkupMatches` on `IEnumerable` and `IElement`. By [@jgoday](https://github.com/jgoday).
14+
15+
- Added `BunitErrorBoundaryLogger` implementation of `IErrorBoundaryLogger` (needed for Blazor's ErrorBoundary component in .NET 6.0). By [@jgoday](https://github.com/jgoday).
16+
17+
- 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).
18+
19+
Learn more about this feature on the [Controlling component instantiation](https://bunit.dev/docs/providing-input/controlling-component-instantiation) page.
20+
21+
- 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).
22+
23+
- 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).
24+
25+
### Changed
26+
27+
List of changes in this release.
28+
29+
- 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).
30+
31+
- Updated .NET 6 dependencies to preview 5. By [@egil](https://github.com/egil).
32+
33+
### Fixed
34+
35+
List of fixes in this release.
36+
37+
- 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).
38+
39+
- 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.
40+
41+
- Fixed handling of escaped uri's in FakeNavigationManager. By [@linkdotnet](https://github.com/linkdotnet) in [#460](https://github.com/bUnit-dev/bUnit/pull/460).
42+
43+
- 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).
44+
945
## [1.1.5] - 2021-04-30
1046

1147
### Added
1248

13-
- All bUnit assemblies is now strong named signed.
14-
- Added .NET 6 (preview 3) as a target framework for bUnit, bUnit.core and bUnit.web.
49+
- All bUnit assemblies is now strong named signed.
50+
51+
- Added .NET 6 (preview 3) as a target framework for bUnit, bUnit.core and bUnit.web.
1552

1653
### Changed
1754

18-
- Changed bunit.template such that created projects only reference the bunit package. Bumped other referenced packages to latest version.
55+
- Changed bunit.template such that created projects only reference the bUnit package. Bumped other referenced packages to latest version.
56+
57+
- Changed TestServiceProvider to validate scopes of registered services, such that it behaves like the service provider (default IoC container) in Blazor.
1958

2059
## [1.0.16]
2160

CODE-OF-CONDUCT.md

Lines changed: 2 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,2 @@
1-
# Contributor Covenant Code of Conduct
2-
3-
## Our Pledge
4-
5-
In the interest of fostering an open and welcoming environment, we as
6-
contributors and maintainers pledge to make our project and
7-
community a harassment-free experience for everyone, regardless of age,
8-
size, disability, ethnicity, sexuality, gender identity and expression,
9-
level of experience, education, socio-economic status, nationality, personal
10-
appearance, race, or religion.
11-
12-
## Our Standards
13-
14-
Examples of behavior that contribute towards creating a positive environment
15-
include:
16-
17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
22-
23-
Examples of unacceptable behavior by participants include:
24-
25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
32-
professional setting
33-
34-
## Our Responsibilities
35-
36-
Project maintainers are responsible for clarifying the standards of acceptable
37-
behavior and are expected to take appropriate and fair corrective action in
38-
response to any instances of unacceptable behavior.
39-
40-
Project maintainers have the right and responsibility to remove, edit, or
41-
reject comments, commits, code, wiki edits, issues, and other contributions
42-
that are not aligned to this Code of Conduct, or to temporarily or
43-
permanently ban any contributor for other behaviors that they deem inappropriate,
44-
threatening, offensive, or harmful.
45-
46-
## Scope
47-
48-
This Code of Conduct applies within all project spaces, and it also applies when
49-
an individual is representing the project or its community in public spaces.
50-
Examples of representing a project or community include using an official
51-
project e-mail address, posting via an official social media account, or acting
52-
as an appointed representative at an online or offline event. Representation of
53-
a project may be further defined and clarified by project maintainers.
54-
55-
## Enforcement
56-
57-
Instances of abuse, harassment, or otherwise unacceptable behavior may be
58-
reported by contacting the project leader at [[email protected]](mailto:[email protected]). All
59-
complaints will be reviewed and investigated and will result in a response that
60-
is deemed necessary and appropriate to the circumstances. The project team is
61-
obligated to maintain confidentiality with regard to the reporter of an incident.
62-
Further details of specific enforcement policies may be posted separately.
63-
64-
Project maintainers who do not follow or enforce the Code of Conduct in good
65-
faith may face temporary or permanent repercussions as determined by other
66-
members of the project's leadership.
67-
68-
## Attribution
69-
70-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71-
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72-
73-
[homepage]: https://www.contributor-covenant.org
74-
75-
For answers to common questions about this code of conduct, see
76-
https://www.contributor-covenant.org/faq
1+
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community.
2+
For more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).

0 commit comments

Comments
 (0)