Files
reverse-engineering-anything/tests/boundary/filesystem/dotnetBundleIntegration.test.ts
T
记得吃中饭andgensokyo-dev 22cab8215a feat(artifacts): inspect and extract .NET single-file bundles (#3787)
* feat(artifacts): inventory and extract .NET single-file bundles

* fix(artifacts): retain bundle source I/O failure reasons

* docs(artifacts): record Linux bundle regression verification

* fix(artifacts): preserve bundle source failures and cancellation

* docs(artifacts): record synchronized bundle verification

* fix(artifacts): bind bundle extraction to inventoried host

* docs(artifacts): record bundle verification outcome

* fix(artifacts): bound bundle paths and suggest extraction

* fix(artifacts): preserve nested executable container boundaries

* test(artifacts): verify projected .NET members and simplify extraction admission

* fix(artifacts): explain fixed bundle limits at their producing boundary

---------

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-10-29 20:06:58 +08:00

44 lines
1.6 KiB
TypeScript

import { readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { expect, it, vi } from "vitest";
import * as dotnetLayout from "../../../src/artifacts/dotnet/DotnetBundle.js";
import { dotnetBundleFixture } from "../../../src/artifacts/dotnet/DotnetBundle.fixture.js";
import { ArtifactResourceScope } from "../../../src/artifacts/ArtifactResourceScope.js";
import { extractArtifact } from "../../../src/artifacts/extraction/ArtifactExtraction.js";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
it("shares a single marker scan through extraction preflight, inventory and materialization", async () => {
const root = await createTestTempDirectory("rea-dotnet-shared-scan-");
const path = join(root, "host");
const member = Buffer.from("owned .NET resource".repeat(128));
await writeFile(
path,
dotnetBundleFixture([
{ path: "data/resource.txt", bytes: member, compressed: true },
]).bytes,
);
const locate = vi.spyOn(dotnetLayout, "findDotnetBundleHeader");
const resources = new ArtifactResourceScope();
const output = join(root, "out");
try {
await extractArtifact({
inputPath: path,
inputFormat: "pe",
outputRoot: output,
environment: process.env,
resourceScope: resources,
integrityPolicy: "fail",
});
expect(
(await readFile(join(output, "data/resource.txt"))).equals(member),
).toBe(true);
expect(locate).toHaveBeenCalledTimes(1);
} finally {
try {
await resources.close();
} finally {
locate.mockRestore();
}
}
});