(env)
| 93 | const { execFileSync } = require('child_process'); |
| 94 | |
| 95 | function runBridgeCheck(env) { |
| 96 | const script = ` |
| 97 | delete process.env.EVOLVE_BRIDGE; |
| 98 | delete process.env.OPENCLAW_WORKSPACE; |
| 99 | ${env.EVOLVE_BRIDGE !== undefined ? `process.env.EVOLVE_BRIDGE = ${JSON.stringify(env.EVOLVE_BRIDGE)};` : ''} |
| 100 | ${env.OPENCLAW_WORKSPACE !== undefined ? `process.env.OPENCLAW_WORKSPACE = ${JSON.stringify(env.OPENCLAW_WORKSPACE)};` : ''} |
| 101 | const { determineBridgeEnabled } = require('./src/evolve'); |
| 102 | console.log(determineBridgeEnabled()); |
| 103 | `; |
| 104 | const cleanEnv = { |
| 105 | ...process.env, |
| 106 | NODE_DISABLE_COLORS: '1', |
| 107 | NO_COLOR: '1', |
| 108 | FORCE_COLOR: '0', |
| 109 | // Silence the one-shot "Using host git repository at:" banner in |
| 110 | // paths.js so stdout contains only the bridge value and trim() yields |
| 111 | // a deterministic string. See issue #430. |
| 112 | EVOLVER_QUIET_PARENT_GIT: '1', |
| 113 | }; |
| 114 | delete cleanEnv.EVOLVE_BRIDGE; |
| 115 | delete cleanEnv.OPENCLAW_WORKSPACE; |
| 116 | const raw = execFileSync(process.execPath, ['-e', script], { |
| 117 | cwd: require('path').resolve(__dirname, '..'), |
| 118 | encoding: 'utf8', |
| 119 | timeout: 10000, |
| 120 | env: cleanEnv, |
| 121 | }); |
| 122 | return stripAnsi(raw).trim(); |
| 123 | } |
| 124 | |
| 125 | it('standalone mode: bridge off', () => { |
| 126 | assert.equal(runBridgeCheck({}), 'false'); |
no test coverage detected