Skip to content

Commit 3268fdf

Browse files
jfblaaclaude
andauthored
test(manifest): follow the .NET facts simplifications
Pass the dotnet config whole to convertDotnetToFacts, and check that a recursive run does not list a solution's members for coverage recorded by another tool's builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 8b2ae27 commit 3268fdf

2 files changed

Lines changed: 45 additions & 5 deletions

File tree

‎src/commands/manifest/generate-recursive-manifests.test.mts‎

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ vi.mock('./run-manifest-facts.mts', () => ({
1717
}))
1818
vi.mock('./scripts/run.mts', async importOriginal => ({
1919
...(await importOriginal<typeof import('./scripts/run.mts')>()),
20+
listDotnetEntryProjects: vi.fn(async () => undefined),
2021
skipWithoutDotnetSdk: vi.fn(async () => false),
2122
}))
2223

2324
import { buildRootPath } from './discover-manifest-roots.mts'
2425
import { generateRecursiveManifests } from './generate-recursive-manifests.mts'
2526
import { runManifestFacts } from './run-manifest-facts.mts'
26-
import { skipWithoutDotnetSdk } from './scripts/run.mts'
27+
import {
28+
listDotnetEntryProjects,
29+
skipWithoutDotnetSdk,
30+
} from './scripts/run.mts'
2731
import { testPath } from '../../../test/utils.mts'
2832
import {
2933
readOrDefaultSocketJson,
@@ -550,6 +554,40 @@ describe('generateRecursiveManifests', () => {
550554
}
551555
})
552556

557+
it("does not list a solution's members for coverage another tool's builds recorded", async () => {
558+
const dir = await fs.mkdtemp(path.join(tmpdir(), 'dsi-per-tool-'))
559+
try {
560+
await fs.writeFile(path.join(dir, 'pom.xml'), '<project/>')
561+
await fs.writeFile(path.join(dir, 'App.sln'), '')
562+
vi.mocked(listDotnetEntryProjects).mockClear()
563+
vi.mocked(runManifestFacts).mockImplementation(
564+
async ({ cwd, entryFile }) => ({
565+
factsPath: path.join(cwd, `${entryFile}.socket.facts.json`),
566+
projects: [
567+
{
568+
type: 'maven',
569+
name: 'app',
570+
subprojectDir: '',
571+
manifestFiles: [{ file: 'pom.xml' }],
572+
children: [],
573+
},
574+
],
575+
}),
576+
)
577+
const outcomes = await generateRecursiveManifests({
578+
cwd: dir,
579+
verbose: false,
580+
})
581+
582+
expect(
583+
outcomes.map(o => `${o.ecosystem}:${o.entryFile}:${o.status}`).sort(),
584+
).toEqual(['dotnet:App.sln:generated', 'maven:pom.xml:generated'])
585+
expect(listDotnetEntryProjects).not.toHaveBeenCalled()
586+
} finally {
587+
await fs.rm(dir, { recursive: true, force: true })
588+
}
589+
})
590+
553591
it('resolves each build root its own nearest socket.json instead of only the root config', async () => {
554592
vi.mocked(readSocketJsonCascade).mockImplementation(
555593
(dir, _boundaryDir, fallback) =>

‎src/commands/manifest/generate_auto_manifest.test.mts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,11 +446,13 @@ describe('generateAutoManifest — dotnet branch', () => {
446446
)
447447
expect(convertDotnetToFacts).toHaveBeenCalledWith(
448448
expect.objectContaining({
449-
bin: '/opt/dotnet/dotnet',
449+
config: expect.objectContaining({
450+
bin: '/opt/dotnet/dotnet',
451+
buildOpts: ['-p:Configuration=Release'],
452+
ignoreUnresolved: true,
453+
includeConfigs: 'net8.0',
454+
}),
450455
cwd: '/tmp/repo',
451-
dotnetOpts: ['-p:Configuration=Release'],
452-
ignoreUnresolved: true,
453-
includeConfigs: 'net8.0',
454456
}),
455457
)
456458
})

0 commit comments

Comments
 (0)