summaryrefslogtreecommitdiff
path: root/integration-tests/run-tests.js
diff options
context:
space:
mode:
authormatt korwel <[email protected]>2025-07-06 20:16:42 -0700
committerGitHub <[email protected]>2025-07-07 03:16:42 +0000
commit20825e41148a58998a6b1e5869149eac8d09cfbd (patch)
treea228489987cd2e50925e5c9e97f5b9d0aa9c5e73 /integration-tests/run-tests.js
parent39d4095a4c0f3478235aa0c80c94586b9e2662c2 (diff)
Release misc (#3418)
Diffstat (limited to 'integration-tests/run-tests.js')
-rw-r--r--integration-tests/run-tests.js50
1 files changed, 37 insertions, 13 deletions
diff --git a/integration-tests/run-tests.js b/integration-tests/run-tests.js
index 1e8ccad9..5923dfcf 100644
--- a/integration-tests/run-tests.js
+++ b/integration-tests/run-tests.js
@@ -72,35 +72,59 @@ async function main() {
`------------- Running test file: ${testFileName} ------------------------------`,
);
- const child = spawn('node', ['--test', testFile], {
+ const nodeArgs = ['--test'];
+ if (verbose) {
+ nodeArgs.push('--test-reporter=spec');
+ }
+ nodeArgs.push(testFile);
+
+ const child = spawn('node', nodeArgs, {
stdio: 'pipe',
env: {
...process.env,
GEMINI_CLI_INTEGRATION_TEST: 'true',
INTEGRATION_TEST_FILE_DIR: testFileDir,
KEEP_OUTPUT: keepOutput.toString(),
+ VERBOSE: verbose.toString(),
TEST_FILE_NAME: testFileName,
},
});
- if (verbose) {
- child.stdout.pipe(process.stdout);
- child.stderr.pipe(process.stderr);
- }
-
+ let outputStream;
if (keepOutput) {
const outputFile = join(testFileDir, 'output.log');
- const outputStream = createWriteStream(outputFile);
- child.stdout.pipe(outputStream);
- child.stderr.pipe(outputStream);
+ outputStream = createWriteStream(outputFile);
console.log(`Output for ${testFileName} written to: ${outputFile}`);
- } else if (!verbose) {
- child.stdout.pipe(process.stdout);
- child.stderr.pipe(process.stderr);
}
+ child.stdout.on('data', (data) => {
+ if (verbose) {
+ process.stdout.write(data);
+ }
+ if (outputStream) {
+ outputStream.write(data);
+ }
+ });
+
+ child.stderr.on('data', (data) => {
+ if (verbose) {
+ process.stderr.write(data);
+ }
+ if (outputStream) {
+ outputStream.write(data);
+ }
+ });
+
const exitCode = await new Promise((resolve) => {
- child.on('close', resolve);
+ child.on('close', (code) => {
+ if (outputStream) {
+ outputStream.end(() => {
+ resolve(code);
+ });
+ } else {
+ resolve(code);
+ }
+ });
});
if (exitCode !== 0) {