(pathname: string, opts: RequestInit = {})
| 35 | let queueFile: string = ''; |
| 36 | |
| 37 | async function api(pathname: string, opts: RequestInit = {}): Promise<Response> { |
| 38 | const headers: Record<string, string> = { |
| 39 | 'Content-Type': 'application/json', |
| 40 | ...(opts.headers as Record<string, string> || {}), |
| 41 | }; |
| 42 | if (!headers['Authorization'] && authToken) { |
| 43 | headers['Authorization'] = `Bearer ${authToken}`; |
| 44 | } |
| 45 | return fetch(`http://127.0.0.1:${serverPort}${pathname}`, { ...opts, headers }); |
| 46 | } |
| 47 | |
| 48 | beforeAll(async () => { |
| 49 | tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'sidebar-e2e-url-')); |
no test coverage detected