Repository navigation
test(manifest): cover the .NET facts producer #1681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Jeppe Fredsgaard Blaabjerg (jfblaa)
merged 5 commits into
v1.x
from
jfblaa/dotnet-socket-facts-tests
Nov 3, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4cf4153
test(manifest): cover the .NET facts producer
jfblaa 6e390b5
test(manifest): cover .NET listings, scan-root exclusions and CLI wiring
jfblaa 8b2ae27
test(manifest): cover the .NET review fixes
jfblaa 3268fdf
test(manifest): follow the .NET facts simplifications
jfblaa 7ef01ed
test(manifest): simplify the .NET facts tests
jfblaa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import { describe, expect } from 'vitest' | ||
|
|
||
| import constants, { | ||
| FLAG_CONFIG, | ||
| FLAG_DRY_RUN, | ||
| FLAG_HELP, | ||
| } from '../../../src/constants.mts' | ||
| import { cmdit, spawnSocketCli } from '../../../test/utils.mts' | ||
|
|
||
| describe('socket manifest dotnet', async () => { | ||
| const { binCliPath } = constants | ||
|
|
||
| cmdit( | ||
| ['manifest', 'dotnet', FLAG_HELP, FLAG_CONFIG, '{}'], | ||
| `should support ${FLAG_HELP}`, | ||
| async cmd => { | ||
| const { code, stderr, stdout } = await spawnSocketCli(binCliPath, cmd) | ||
| expect(stdout).toMatchInlineSnapshot(` | ||
| "[beta] Generate Socket facts files from .NET solutions and projects | ||
|
|
||
| Usage | ||
| $ socket manifest dotnet [options] [CWD=.|FILE] | ||
|
|
||
| Options | ||
| --bin Location of the dotnet binary to use, default: dotnet on PATH | ||
| --dotnet-opts Additional options to pass on to \`dotnet restore\`, e.g. \`-p:Configuration=Release --configfile nuget.config\`. MSBuild properties among them also apply to project evaluation | ||
| --exclude-configs Comma-separated glob patterns; target frameworks matching any pattern are skipped (applied after --include-configs) | ||
| --exclude-paths List of glob patterns to exclude from manifest/facts generation. Patterns are anchored micromatch globs matched relative to CWD (\`--cwd\` if set): \`tests\` matches only \`<cwd>/tests\`; use \`**/tests\` to match at any depth. Negation patterns (\`!path\`) are not supported. Accepts a comma-separated value or multiple flags. An excluded JVM build module is not analysed as a project of its own, but where a project that is not excluded depends on it, its code is analysed as part of that project. A build module outside CWD cannot be excluded. | ||
| --ignore-unresolved Warn on unresolved dependencies instead of failing the run (unresolved deps are not emitted to the facts file) | ||
| --include-configs Comma-separated glob patterns matched against target frameworks (case-sensitive; \`*\`, \`?\`, and \`[...]\` wildcards). Only target frameworks matching at least one pattern are read, e.g. \`net8.0\`. A runtime-specific target (\`net8.0/win-x64\`) also matches its framework. Default: every target framework | ||
| --verbose Print debug messages | ||
|
|
||
| Emits a \`<file>.socket.facts.json\` per solution or project describing its | ||
| resolved NuGet dependency graph. Given a directory, it builds every | ||
| solution (.sln, .slnx) and project (.csproj, .fsproj, .vbproj) at its top | ||
| level, solutions first, skipping projects a solution already covers; given | ||
| a file, just that one (a .slnf solution filter too). | ||
|
|
||
| Dependencies come from your own \`dotnet restore\` (same SDK, global.json, | ||
| nuget.config and credential providers), so a build that restores for you | ||
| restores here. PackageReference projects (central package management and | ||
| lock files included) and packages.config projects are supported. An | ||
| unresolved dependency is a fatal error unless --ignore-unresolved. | ||
|
|
||
| Support is beta. Please report issues or give us feedback on what's missing. | ||
|
|
||
| Examples | ||
|
|
||
| $ socket manifest dotnet . | ||
| $ socket manifest dotnet ./App.sln | ||
| $ socket manifest dotnet --dotnet-opts="-p:Configuration=Release" ." | ||
| `) | ||
| expect(`\n ${stderr}`).toMatchInlineSnapshot(` | ||
| " | ||
| _____ _ _ /--------------- | ||
| | __|___ ___| |_ ___| |_ | CLI: <redacted> | ||
| |__ | * | _| '_| -_| _| | token: <redacted>, org: <redacted> | ||
| |_____|___|___|_,_|___|_|.dev | Command: \`socket manifest dotnet\`, cwd: <redacted>" | ||
| `) | ||
|
|
||
| expect(code, 'explicit help should exit with code 0').toBe(0) | ||
| expect(stderr, 'banner includes base command').toContain( | ||
| '`socket manifest dotnet`', | ||
| ) | ||
| }, | ||
| ) | ||
|
|
||
| cmdit( | ||
| ['manifest', 'dotnet', FLAG_DRY_RUN, FLAG_CONFIG, '{}'], | ||
| 'should require args with just dry-run', | ||
| async cmd => { | ||
| const { code, stderr, stdout } = await spawnSocketCli(binCliPath, cmd) | ||
| expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Bailing now"`) | ||
| expect(`\n ${stderr}`).toMatchInlineSnapshot(` | ||
| " | ||
| _____ _ _ /--------------- | ||
| | __|___ ___| |_ ___| |_ | CLI: <redacted> | ||
| |__ | * | _| '_| -_| _| | token: <redacted>, org: <redacted> | ||
| |_____|___|___|_,_|___|_|.dev | Command: \`socket manifest dotnet\`, cwd: <redacted>" | ||
| `) | ||
|
|
||
| expect(code, 'dry-run should exit with code 0 if input ok').toBe(0) | ||
| }, | ||
| ) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: this is the fourth copy of the temp-dir hooks in the file, and one file-level pair would replace them all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[agent] Fixed in 30d5794 - one file-level pair replaces all four.