-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_test.js
More file actions
29 lines (25 loc) · 1.25 KB
/
run_test.js
File metadata and controls
29 lines (25 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { test } = require('node:test');
const { execFile } = require('node:child_process');
const util = require('node:util');
const execFileAsync = util.promisify(execFile);
const path = require('node:path');
const fs = require('node:fs/promises');
const { makeSandbox, runCli, parseCliJson, pathExists } = require('./test/helpers.cjs');
async function run() {
const sandbox = await makeSandbox('superplan-init-claude-root-');
await runCli(['init', '--global', '--quiet', '--json'], { cwd: sandbox.cwd, env: sandbox.env });
await fs.writeFile(path.join(sandbox.cwd, 'CLAUDE.md'), '# repo claude prefs\n');
await fs.mkdir(path.join(sandbox.cwd, '.claude'), { recursive: true });
await fs.writeFile(
path.join(sandbox.cwd, '.claude', 'settings.local.json'),
`${JSON.stringify({
permissions: { allow: ['Bash(superplan init:*)'] },
hooks: { sessionStart: [{ command: './session-start' }] },
}, null, 2)}\n`,
);
const initResult = await runCli(['init', '--yes', '--json'], { cwd: sandbox.cwd, env: sandbox.env });
console.log('INIT STDERR:', initResult.stderr);
console.log('INIT STDOUT:', initResult.stdout);
console.log('CLAUDE EXISTS:', await pathExists(path.join(sandbox.cwd, '.claude', 'CLAUDE.md')));
}
run().catch(console.error);