| 319 | } |
| 320 | |
| 321 | export class TestRoot { |
| 322 | readonly initialize: Promise<Dap.InitializeResult>; |
| 323 | readonly log: Log; |
| 324 | readonly assertLog: AssertLog; |
| 325 | |
| 326 | private _targetToP = new Map<ITarget, ITestHandle>(); |
| 327 | private _root: Session; |
| 328 | private _workspaceRoot: string; |
| 329 | private _webRoot: string | undefined; |
| 330 | _launchUrl: string | undefined; |
| 331 | private _args: string[]; |
| 332 | |
| 333 | private _worker: Promise<ITestHandle>; |
| 334 | private _workerCallback: (session: ITestHandle) => void; |
| 335 | private _launchCallback: (session: ITestHandle) => void; |
| 336 | |
| 337 | _browserLauncher: BrowserLauncher<AnyChromiumLaunchConfiguration> | undefined; |
| 338 | readonly binder: Binder; |
| 339 | |
| 340 | private _onSessionCreatedEmitter = new EventEmitter<ITestHandle>(); |
| 341 | readonly onSessionCreated = this._onSessionCreatedEmitter.event; |
| 342 | public readonly logger: ILogger; |
| 343 | |
| 344 | constructor(goldenText: GoldenText, private _testTitlePath: string) { |
| 345 | this._args = ['--headless']; |
| 346 | this.log = goldenText.log.bind(goldenText); |
| 347 | this.assertLog = goldenText.assertLog.bind(goldenText); |
| 348 | this._workspaceRoot = utils.platformPathToPreferredCase(testWorkspace); |
| 349 | this._webRoot = path.join(this._workspaceRoot, 'web'); |
| 350 | |
| 351 | const storagePath = path.join(__dirname, '..', '..'); |
| 352 | // todo: make a more proper mock here |
| 353 | const workspaceState = new Map<string, unknown>(); |
| 354 | const services = createTopLevelSessionContainer( |
| 355 | createGlobalContainer({ |
| 356 | storagePath, |
| 357 | isVsCode: true, |
| 358 | context: upcastPartial<ExtensionContext>({ |
| 359 | workspaceState: { |
| 360 | keys: () => [], |
| 361 | get<T>(key: string, defaultValue?: T) { |
| 362 | return workspaceState.get(key) ?? defaultValue; |
| 363 | }, |
| 364 | update(key: string, value: unknown) { |
| 365 | workspaceState.set(key, value); |
| 366 | return Promise.resolve(); |
| 367 | }, |
| 368 | }, |
| 369 | }), |
| 370 | }), |
| 371 | ); |
| 372 | |
| 373 | this.logger = services.get(ILogger); |
| 374 | this._root = new Session(this.logger); |
| 375 | const dap = this._root.adapterConnection.dap(); |
| 376 | dap.on('initialize', async () => { |
| 377 | dap.initialized({}); |
| 378 | return DebugAdapter.capabilities(); |
nothing calls this directly
no outgoing calls
no test coverage detected