fix(gemini): implement official hook contract
This commit is contained in:
1 parent
e011003680
commit
586ffa0278
13 files changed
+1950
-142
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import {
|
||||
createFixture,
|
||||
runProcess,
|
||||
} from '../test-support/gemini-test-helpers.mjs';
|
||||
|
||||
const geminiEntry = process.env.ELYDORA_GEMINI_ENTRY;
|
||||
|
||||
test('official Gemini CLI accepts the installed user hook contract', {
|
||||
skip: geminiEntry ? false : 'set ELYDORA_GEMINI_ENTRY to the official Gemini CLI entry file',
|
||||
}, async () => {
|
||||
const fixture = await createFixture();
|
||||
try {
|
||||
const install = await fixture.install();
|
||||
assert.equal(install.code, 0, install.stderr);
|
||||
const environment = {
|
||||
HOME: fixture.homeDir,
|
||||
USERPROFILE: fixture.homeDir,
|
||||
GEMINI_CLI_HOME: fixture.geminiCliHome,
|
||||
GEMINI_API_KEY: 'official-loader-test-key',
|
||||
GEMINI_TELEMETRY_ENABLED: 'false',
|
||||
OTEL_SDK_DISABLED: 'true',
|
||||
};
|
||||
const version = await runProcess(
|
||||
process.execPath,
|
||||
[geminiEntry, '--version'],
|
||||
environment,
|
||||
fixture.projectDir,
|
||||
);
|
||||
assert.equal(version.code, 0, version.stderr);
|
||||
assert.match(version.stdout, /0\.51\.0/);
|
||||
|
||||
const load = await runProcess(
|
||||
process.execPath,
|
||||
[geminiEntry, '--skip-trust', '--list-extensions'],
|
||||
environment,
|
||||
fixture.projectDir,
|
||||
);
|
||||
assert.equal(load.code, 0, load.stderr);
|
||||
assert.doesNotMatch(
|
||||
`${load.stdout}\n${load.stderr}`,
|
||||
/invalid settings|settings validation|failed to parse|hook configuration error/i,
|
||||
);
|
||||
} finally {
|
||||
await fixture.close();
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user