ECMAScript.Pinia.Testing
0.1.23
dotnet add package ECMAScript.Pinia.Testing --version 0.1.23
NuGet\Install-Package ECMAScript.Pinia.Testing -Version 0.1.23
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ECMAScript.Pinia.Testing" Version="0.1.23" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ECMAScript.Pinia.Testing" Version="0.1.23" />
<PackageReference Include="ECMAScript.Pinia.Testing" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ECMAScript.Pinia.Testing --version 0.1.23
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ECMAScript.Pinia.Testing, 0.1.23"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ECMAScript.Pinia.Testing@0.1.23
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ECMAScript.Pinia.Testing&version=0.1.23
#tool nuget:?package=ECMAScript.Pinia.Testing&version=0.1.23
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ECMAScript.Pinia.Testing
ECMAScript.Pinia.Testing 是独立于 ECMAScript.Pinia 主包的 @pinia/testing 绑定线,用于承载测试期 Pinia root / spy / initial-state authoring contract。
Responsibilities
- 提供
createTestingPinia()的 C# host binding。 - 提供
TestingOptions、TestingOptions<TDelegate>、TestingOptions<TDelegate, TStore>、TestingInitialState、PiniaTestingSpyFactory、TestingStubActions.From(...)、TestingStubActions<TStore>.From(...)、ProjectPlugin(...)、ProjectStubActionPredicate(...)、ProjectStubActions(...)等测试包契约。 - 保持
@pinia/testing与pinia主包边界分离,避免把测试专用 surface 混进生产主包。
Boundaries
- 不把
@pinia/testingAPI 合并进src/ECMAScript.Pinia/。 - 不尝试镜像测试框架(Vitest/Jest)自身 spy 类型;只保留 Pinia 侧配置契约。
- 当调用方需要保留一个具体 delegate 签名时,使用
TestingOptions<TDelegate>显式收口createSpyauthoring;runtime 仍保持同一个createSpyobject-form 配置字段。 - 当同一个 testing root 既需要显式
createSpydelegate 形状,又需要显式stubActionsstore 投影时,使用TestingOptions<TDelegate, TStore>;它只增强 compile-time authoring,不改变 runtime options object shape。 - 当对象初始化器里的
StubActions = ...需要稳定承接 predicate / named-list / boolean 分支时,使用TestingStubActions.From(...)或TestingStubActions<TStore>.From(...);这和VueRoute的 union factory 模式一致,避免依赖多跳隐式转换。 - 当调用方需要把
stubActionspredicate 收口到一个显式 store 投影时,使用ProjectStubActionPredicate<TStore>(...);该 helper 只做类型级 identity 投影,不创建新的 runtime predicate 函数对象。 - 当调用方希望把 typed
stubActionspredicate 直接放进 typed options 的 union surface 时,使用ProjectStubActions<TStore>(...);该 helper 同样只做类型级 identity 投影,不创建新的 runtime wrapper。 - 当测试根需要复用主包里的 typed / projected Pinia plugin 时,使用
ProjectPlugin(...)把 typed plugin callback 显式投影到TestingOptions.Plugins所需的 untypedPiniaPlugin形状;该 helper 只做类型级 identity 投影,不创建新的 runtime plugin 函数对象。 - 当前聚焦
createTestingPinia()主路径与高频 options,不内建测试 runner 适配层。
Layout
PiniaTesting.cs- 模块入口,只保留导入标记和委托声明。
Api/PiniaTesting.Api.cscreateTestingPinia(...)、ProjectPlugin(...)、ProjectStubActionPredicate(...)、ProjectStubActions(...)入口。
Types/PiniaTesting.Types.csTestingOptions、TestingOptions<TDelegate>、TestingOptions<TDelegate, TStore>、TestingStubActions、TestingStubActions<TStore>、TestingInitialState等测试专用运行时形状。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net11.0
- ECMAScript.Pinia (>= 0.1.23)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.23 | 49 | 5/14/2026 |