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
                    
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="Mcqdb.NScript.SunlightTestAdapter" Version="1.1.8">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mcqdb.NScript.SunlightTestAdapter" Version="1.1.8" />
                    
Directory.Packages.props
<PackageReference Include="Mcqdb.NScript.SunlightTestAdapter">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
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 Mcqdb.NScript.SunlightTestAdapter --version 1.1.8
                    
#r "nuget: Mcqdb.NScript.SunlightTestAdapter, 1.1.8"
                    
#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 Mcqdb.NScript.SunlightTestAdapter@1.1.8
                    
#: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=Mcqdb.NScript.SunlightTestAdapter&version=1.1.8
                    
Install as a Cake Addin
#tool nuget:?package=Mcqdb.NScript.SunlightTestAdapter&version=1.1.8
                    
Install as a Cake Tool

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

  1. Discovery — Reads [TestFixture] / [Test] attribute metadata from a NScript-compiled test DLL using MetadataLoadContext, so the NScript mscorlib facade does not need to resolve at runtime.
  2. Execution — Launches headless Chromium via Microsoft.Playwright, serves the NScript-emitted JavaScript bundle from a synthetic URL, loads QUnit 2.x, and reads testEnd / runEnd events 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.prototype runtime slots after minification.
  • SunlightUnit is not transitive. You write [TestFixture] / [Test] attributes in your own test project — install Mcqdb.NScript.SunlightUnit there directly.

Source

Sources/Compiler/SunlightTestAdapter/ in the NScript repository.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.1.8 91 5/30/2026
1.1.7 104 5/23/2026
1.1.4 91 5/18/2026
1.1.1 100 5/17/2026
1.1.0 91 5/13/2026