test(server): reduce npm fixture setup in the Windows timeout case (#8106)

* test(server): batch npm fixture packing to reduce Windows setup time

* test(server): describe the batched npm fixture setup budget

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
This commit is contained in:
paseo-bot[bot]
2026-10-28 12:57:33 +00:00
committed by GitHub
parent 9fb7808191
commit 8537709e72
2 changed files with 14 additions and 7 deletions
@@ -1323,8 +1323,8 @@ export default function contribute(plugin: unknown) {
describe("npm plugin installation", () => {
let registry: Awaited<ReturnType<typeof startNpmRegistry>>;
// Packing the registry starts eleven real npm processes. Give fixture construction its
// own setup budget so Windows process startup does not consume the installation journey.
// Give real npm fixture construction its own setup budget so it does not consume
// the installation journey on Windows.
beforeAll(async () => {
const packages = npmPluginPackages();
const fixture = packages[1];
+12 -5
View File
@@ -50,6 +50,7 @@ export async function startNpmRegistry(packages: FixturePackage[]) {
`registry=${url}/\n//127.0.0.1:${address.port}/:_authToken=fixture-token\ncache=${root}/cache\n`,
);
try {
const prepared = [];
for (const [index, pkg] of packages.entries()) {
const directory = path.join(root, String(index));
await mkdir(directory);
@@ -65,11 +66,17 @@ export async function startNpmRegistry(packages: FixturePackage[]) {
await mkdir(path.dirname(path.join(directory, file)), { recursive: true });
await writeFile(path.join(directory, file), content);
}
const { stdout } = await execCommand("npm", ["pack", "--ignore-scripts", "--json"], {
cwd: directory,
});
const packed: Array<{ filename: string }> = JSON.parse(stdout);
const artifact = await readFile(path.join(directory, packed[0].filename));
prepared.push({ directory, manifest, pkg, index });
}
// Pack all fixtures in one npm process instead of paying startup once per package.
const { stdout } = await execCommand(
"npm",
["pack", "--ignore-scripts", "--json", ...prepared.map(({ directory }) => directory)],
{ cwd: root },
);
const packed: Array<{ filename: string }> = JSON.parse(stdout);
for (const { manifest, pkg, index } of prepared) {
const artifact = await readFile(path.join(root, packed[index].filename));
const artifactPath = `/artifacts/${index}.tgz`;
artifacts.set(artifactPath, artifact);
const published = {