Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions test/helpers/onboard-child-runtime.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

function installPromptQueue(target, configuredAnswers) {
const answers = [...configuredAnswers];
const messages = [];
const prompts = [];
target.prompt = async (message, options = {}) => {
messages.push(message);
prompts.push({ message, secret: options.secret === true });
return answers.shift() ?? "";
};
return { answers, messages, prompts };
}

async function captureChildConsole(run) {
const originalLog = console.log;
const originalError = console.error;
const lines = [];
console.log = (...args) => lines.push(args.join(" "));
console.error = (...args) => lines.push(args.join(" "));
try {
return { value: await run(), lines };
} finally {
console.log = originalLog;
console.error = originalError;
}
}

function reportChildScenario(run) {
const hostLog = console.log;
captureChildConsole(run)
.then(({ value, lines }) => hostLog(JSON.stringify({ ...value, lines })))
.catch((error) => {
console.error(error instanceof Error ? error.stack : String(error));
process.exitCode = 1;
});
}

module.exports = { installPromptQueue, reportChildScenario };
2 changes: 1 addition & 1 deletion test/onboard-selection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ type CredentialBackPayload = {
let credentialBackBatchResults: Map<string, CredentialBackPayload> | undefined;

function runCredentialBackScenarioBatch(): Map<string, CredentialBackPayload> {
const workspace = createOnboardProcessWorkspace("nemoclaw-onboard-credential-back-batch-");
const workspace = onboardProcessWorkspace("nemoclaw-onboard-credential-back-batch-");
const { root: tmpDir } = workspace;
const fakeBin = workspace.binDir;
const agentDefsPath = JSON.stringify(path.join(repoRoot, "src", "lib", "agent", "defs.ts"));
Expand Down
Loading