Mcqdb.NScript.SunlightTestAdapter
1.1.8
dotnet add package Mcqdb.NScript.SunlightTestAdapter --version 1.1.8
NuGet\Install-Package Mcqdb.NScript.SunlightTestAdapter -Version 1.1.8
<PackageReference Include="Mcqdb.NScript.SunlightTestAdapter" Version="1.1.8"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Mcqdb.NScript.SunlightTestAdapter" Version="1.1.8" />
<PackageReference Include="Mcqdb.NScript.SunlightTestAdapter"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Mcqdb.NScript.SunlightTestAdapter --version 1.1.8
#r "nuget: Mcqdb.NScript.SunlightTestAdapter, 1.1.8"
#:package Mcqdb.NScript.SunlightTestAdapter@1.1.8
#addin nuget:?package=Mcqdb.NScript.SunlightTestAdapter&version=1.1.8
#tool nuget:?package=Mcqdb.NScript.SunlightTestAdapter&version=1.1.8
Mcqdb.NScript.SunlightTestAdapter
A VSTest adapter for NScript / SunlightUnit. Lets dotnet test discover and
run NScript-compiled QUnit browser tests — no separate Node runner, no manual
QUnit page wiring.
What it does
- Discovery — Reads
[TestFixture]/[Test]attribute metadata from a NScript-compiled test DLL usingMetadataLoadContext, so the NScriptmscorlibfacade does not need to resolve at runtime. - Execution — Launches headless Chromium via
Microsoft.Playwright, serves the NScript-emitted JavaScript bundle from a synthetic URL, loads QUnit 2.x, and readstestEnd/runEndevents back to VSTest.
Install
In a vanilla .NET 8 wrapper project alongside your NScript test project:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<RunSettingsFilePath>$(MSBuildThisFileDirectory)sunlight.runsettings</RunSettingsFilePath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Mcqdb.NScript.SunlightTestAdapter" Version="1.1.0" />
</ItemGroup>
</Project>
The NScript-compiled test DLL itself targets netstandard2.1 with a custom
mscorlib facade and cannot reference Microsoft.NET.Test.Sdk directly —
hence the thin wrapper above. The wrapper should copy your NScript-compiled
test DLL (and its SunlightUnit / framework siblings) into its own bin/ so
the adapter can resolve attribute metadata.
Configure
Point the adapter at your test assembly and the NScript-emitted JS bundle via
a .runsettings file:
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<TargetFrameworkVersion>net8.0</TargetFrameworkVersion>
</RunConfiguration>
<NSTest>
<TestSourceAssembly>YourSuite.Test.dll</TestSourceAssembly>
<JsFilePath>../../../../path/to/GeneratedScripts/YourSuite.Test.js</JsFilePath>
</NSTest>
</RunSettings>
Run
dotnet test path/to/YourSuite.Test.Runner.csproj -c Debug
The first build of any consumer project invokes playwright install chromium
once via this package's .targets; subsequent builds short-circuit on a
sentinel file in bin/. Opt out by setting NSTestSkipPlaywrightInstall=true
in CI environments that provision Chromium externally.
Caveats
- One bundle per wrapper. Each NScript suite must run in its own wrapper
project / runsettings combo. Two NScript bundles co-loaded in the same page
collide on shared
Function.prototyperuntime slots after minification. - SunlightUnit is not transitive. You write
[TestFixture]/[Test]attributes in your own test project — installMcqdb.NScript.SunlightUnitthere directly.
Source
Sources/Compiler/SunlightTestAdapter/ in the NScript repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Mcqdb.NScript.Sunlight.Logging.Server (>= 1.1.8)
- Microsoft.Playwright (>= 1.49.0)
- System.Reflection.MetadataLoadContext (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.