Skip to content

Commit 8e10888

Browse files
committed
Update TS unit testing for ASP.NET Core
1 parent 2a16f91 commit 8e10888

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

docs/javascript/unit-testing-javascript-with-visual-studio.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Unit testing JavaScript and TypeScript"
33
description: Explore unit testing support in Visual Studio for JavaScript and TypeScript code by using the Node.js Tools for Visual Studio.
4-
ms.date: "12/06/2024"
4+
ms.date: "7/31/2025"
55
ms.topic: "how-to"
66
ms.devlang: javascript
77
author: "mikejo5000"
@@ -107,6 +107,11 @@ The following example is based on the TypeScript React project template provided
107107
});
108108
```
109109

110+
::: moniker range="vs-2022"
111+
> [!IMPORTANT]
112+
> Due to a known [MSBuild issue](https://github.com/dotnet/msbuild/issues/7873), open the folder, *Program Files\Microsoft Visual Studio\2022\\<version\>\Common7\IDE\Extensions\TestPlatform*, and rename *System.Memory.dll* to a different name. This fix enables test discovery.
113+
::: moniker-end
114+
110115
1. Open Test Explorer (choose **Test** > **Test Explorer**) and Visual Studio discovers and displays tests. If tests are not showing initially, then rebuild the project to refresh the list.
111116

112117
![Screenshot of Test Explorer test discovery (.esproj).](../javascript/media/vs-2022/unit-tests-esproj-discovery.png)
@@ -148,9 +153,16 @@ The following example is based on the ASP.NET Core Model-View-Controller project
148153

149154
1. In the **Browse** tab, search for the following packages and install each one:
150155

156+
::: moniker range=">=vs-2022"
157+
- [Microsoft.TypeScript.MSBuild](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild)
158+
- [Npm](https://www.nuget.org/packages/Npm)
159+
::: moniker-end
160+
161+
::: moniker range="vs-2019"
151162
- [Microsoft.TypeScript.MSBuild](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild)
152163
- [Npm](https://www.nuget.org/packages/Npm)
153164
- [Microsoft.JavaScript.UnitTest](https://www.nuget.org/packages/Microsoft.JavaScript.UnitTest/)
165+
::: moniker-end
154166

155167
Use the NuGet package to add TypeScript support instead of the npm TypeScript package.
156168

@@ -337,6 +349,11 @@ The following example is based on the ASP.NET Core Model-View-Controller project
337349
})
338350
```
339351

352+
::: moniker range="vs-2022"
353+
> [!IMPORTANT]
354+
> Due to a known [MSBuild issue](https://github.com/dotnet/msbuild/issues/7873), open the folder, *Program Files\Microsoft Visual Studio\2022\\<version\>\Common7\IDE\Extensions\TestPlatform*, and rename *System.Memory.dll* to a different name. This fix enables test discovery.
355+
::: moniker-end
356+
340357
1. Open Test Explorer (choose **Test** > **Windows** > **Test Explorer**) and Visual Studio discovers and displays tests. If tests are not showing initially, then rebuild the project to refresh the list. The following illustration shows the Jest example, with two different unit test files.
341358

342359
![Screenshot of Test Explorer test discovery (ASP.NET Core).](../javascript/media/vs-2022/unit-tests-asp-dotnet-discovery.png)

0 commit comments

Comments
 (0)