* Locates the bundled language server: the Bazel-built bundle when running under * Bazel, otherwise the `dist/` output of `build.js`.
()
| 52 | * Bazel, otherwise the `dist/` output of `build.js`. |
| 53 | */ |
| 54 | async function resolveServerPath(): Promise<string> { |
| 55 | const runfiles = process.env['JS_BINARY__RUNFILES'] || process.env['RUNFILES_DIR']; |
| 56 | const candidates = runfiles |
| 57 | ? ['_main', 'angular', ''].map((ws) => path.join(runfiles, ws, SERVER_RUNFILES_PATH)) |
| 58 | : []; |
| 59 | candidates.push(path.resolve(TESTS_DIR, '../dist/server/server.js')); |
| 60 | |
| 61 | for (const candidate of candidates) { |
| 62 | try { |
| 63 | await fs.access(candidate); |
| 64 | return candidate; |
| 65 | } catch {} |
| 66 | } |
| 67 | throw new Error(`Server bundle not found. Checked:\n${candidates.join('\n')}`); |
| 68 | } |
| 69 | |
| 70 | export async function startTestServer(workspacePath: string) { |
| 71 | console.log('[LSP TEST DEBUG] Starting tsgo...'); |