MCPcopy Create free account
hub / github.com/Snapchat/Valdi / TestRoot

Class TestRoot

valdi/vscode_debugger/src/test/test.ts:319–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319export class TestRoot {
320 readonly initialize: Promise<Dap.InitializeResult>;
321 readonly log: Log;
322 readonly assertLog: AssertLog;
323
324 private _targetToP = new Map<ITarget, ITestHandle>();
325 private _root: Session;
326 private _workspaceRoot: string;
327 private _webRoot: string | undefined;
328 _launchUrl: string | undefined;
329 private _args: string[];
330
331 private _worker: Promise<ITestHandle>;
332 private _workerCallback: (session: ITestHandle) => void;
333 private _launchCallback: (session: ITestHandle) => void;
334
335 _browserLauncher: BrowserLauncher<AnyChromiumLaunchConfiguration> | undefined;
336 readonly binder: Binder;
337
338 private _onSessionCreatedEmitter = new EventEmitter<ITestHandle>();
339 readonly onSessionCreated = this._onSessionCreatedEmitter.event;
340 public readonly logger: ILogger;
341
342 constructor(goldenText: GoldenText, private _testTitlePath: string) {
343 this._args = ['--headless'];
344 this.log = goldenText.log.bind(goldenText);
345 this.assertLog = goldenText.assertLog.bind(goldenText);
346 this._workspaceRoot = utils.platformPathToPreferredCase(
347 path.join(__dirname, '..', '..', '..', 'testWorkspace'),
348 );
349 this._webRoot = path.join(this._workspaceRoot, 'web');
350
351 const storagePath = path.join(__dirname, '..', '..');
352 const services = createTopLevelSessionContainer(
353 createGlobalContainer({ storagePath, isVsCode: true }),
354 );
355
356 this.logger = services.get(ILogger);
357 this._root = new Session(this.logger);
358 this._root.adapterConnection.dap().then(dap => {
359 dap.on('initialize', async () => {
360 dap.initialized({});
361 return DebugAdapter.capabilities();
362 });
363 dap.on('configurationDone', async () => {
364 return {};
365 });
366 });
367
368 this.binder = new Binder(this, this._root.adapterConnection, services, new TargetOrigin('0'));
369
370 this.initialize = this._root._init();
371
372 this._launchCallback = () => {};
373 this._workerCallback = () => {};
374 this._worker = new Promise(f => (this._workerCallback = f));
375 }
376

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected