workbenchTestServices.ts ×16

Frontier kind: Code frontier

unlabeled · c_d550bc804123

95 tests · 43794 LOC · 188 files · introduces 0 tests · 87 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
16 ranges87 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4058 ranges43794 lines · 188 files · Browse complete extent
All tests (intent)
95 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 87 introduced LOC across 16 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/test/common/workbenchTestServices.ts 87 introduced LOC · 16 ranges

Open complete file

525
526 export class TestFileService implements IFileService {
528 > declare readonly _serviceBrand: undefined;
529 >
530 > private readonly _onDidFilesChange = new Emitter<FileChangesEvent>();
531 > get onDidFilesChange(): Event<FileChangesEvent> { return this._onDidFilesChange.event; }
532 > fireFileChanges(event: FileChangesEvent): void { this._onDidFilesChange.fire(event); }
533 >
534 > private readonly _onDidRunOperation = new Emitter<FileOperationEvent>();
535 > get onDidRunOperation(): Event<FileOperationEvent> { return this._onDidRunOperation.event; }
536 > fireAfterOperation(event: FileOperationEvent): void { this._onDidRunOperation.fire(event); }
537 >
538 > private readonly _onDidChangeFileSystemProviderCapabilities = new Emitter<IFileSystemProviderCapabilitiesChangeEvent>();
539 > get onDidChangeFileSystemProviderCapabilities(): Event<IFileSystemProviderCapabilitiesChangeEvent> { return this._onDidChangeFileSystemProviderCapabilities.event; }
540 > fireFileSystemProviderCapabilitiesChangeEvent(event: IFileSystemProviderCapabilitiesChangeEvent): void { this._onDidChangeFileSystemProviderCapabilities.fire(event); }
541 >
542 > private _onWillActivateFileSystemProvider = new Emitter<IFileSystemProviderActivationEvent>();
543 > readonly onWillActivateFileSystemProvider = this._onWillActivateFileSystemProvider.event;
544 > readonly onDidWatchError = Event.None;
545 >
546 > protected content = 'Hello Html';
547 > protected lastReadFileUri!: URI;
548 >
549 > readonly = false;
550 >
551 > // Tracking functionality for tests
552 > readonly writeOperations: Array<{ resource: URI; content: string }> = [];
553 > readonly readOperations: Array<{ resource: URI }> = [];
554 >
555 > setContent(content: string): void { this.content = content; }
556 > getContent(): string { return this.content; }
557 > getLastReadFileUri(): URI { return this.lastReadFileUri; }
558 >
559 > // Clear tracking data for tests
560 > clearTracking(): void {
561 this.writeOperations.length = 0;
562 this.readOperations.length = 0;
563 }
565 > resolve(resource: URI, _options: IResolveMetadataFileOptions): Promise<IFileStatWithMetadata>;
566 > resolve(resource: URI, _options?: IResolveFileOptions): Promise<IFileStat>;
567 > async resolve(resource: URI, _options?: IResolveFileOptions): Promise<IFileStat> {
568 return createFileStat(resource, this.readonly);
569 }
571 > stat(resource: URI): Promise<IFileStatWithPartialMetadata> {
572 return this.resolve(resource, { resolveMetadata: true });
573 }
575 > async realpath(resource: URI): Promise<URI> {
576 return resource;
577 }
579 > async resolveAll(toResolve: { resource: URI; options?: IResolveFileOptions }[]): Promise<IFileStatResult[]> {
580 const stats = await Promise.all(toResolve.map(resourceAndOption => this.resolve(resourceAndOption.resource, resourceAndOption.options)));
581
582 return stats.map(stat => ({ stat, success: true }));
583 }
585 > readonly notExistsSet = new ResourceMap<boolean>();
586 >
587 > async exists(_resource: URI): Promise<boolean> { return !this.notExistsSet.has(_resource); }
588 >
589 > readShouldThrowError: Error | undefined = undefined;
590 >
591 > async readFile(resource: URI, options?: IReadFileOptions | undefined): Promise<IFileContent> {
592 if (this.readShouldThrowError) {
593 throw this.readShouldThrowError;
602 };
603 }
605 > async readFileStream(resource: URI, options?: IReadFileStreamOptions | undefined): Promise<IFileStreamContent> {
606 if (this.readShouldThrowError) {
607 throw this.readShouldThrowError;
615 };
616 }
618 > writeShouldThrowError: Error | undefined = undefined;
619 >
620 > async writeFile(resource: URI, bufferOrReadable: VSBuffer | VSBufferReadable, options?: IWriteFileOptions): Promise<IFileStatWithMetadata> {
621 await timeout(0);
622
642 return createFileStat(resource, this.readonly);
643 }
645 > move(_source: URI, _target: URI, _overwrite?: boolean): Promise<IFileStatWithMetadata> { return Promise.resolve(null!); }
646 > copy(_source: URI, _target: URI, _overwrite?: boolean): Promise<IFileStatWithMetadata> { return Promise.resolve(null!); }
647 > async cloneFile(_source: URI, _target: URI): Promise<void> { }
648 > createFile(_resource: URI, _content?: VSBuffer | VSBufferReadable, _options?: ICreateFileOptions): Promise<IFileStatWithMetadata> { return Promise.resolve(null!); }
649 > createFolder(_resource: URI): Promise<IFileStatWithMetadata> { return Promise.resolve(null!); }
650 >
651 > onDidChangeFileSystemProviderRegistrations = Event.None;
652 >
653 > private providers = new Map<string, IFileSystemProvider>();
654 >
655 > registerProvider(scheme: string, provider: IFileSystemProvider) {
656 this.providers.set(scheme, provider);
657
658 return toDisposable(() => this.providers.delete(scheme));
659 }
661 > getProvider(scheme: string) {
662 return this.providers.get(scheme);
663 }
665 > async activateProvider(_scheme: string): Promise<void> {
666 this._onWillActivateFileSystemProvider.fire({ scheme: _scheme, join: () => { } });
667 }
668 > async canHandleResource(resource: URI): Promise<boolean> { return this.hasProvider(resource); } workbenchTestServices.ts
669 > hasProvider(resource: URI): boolean { return resource.scheme === Schemas.file || this.providers.has(resource.scheme); }
670 > listCapabilities() {
671 return [
672 { scheme: Schemas.file, capabilities: FileSystemProviderCapabilities.FileOpenReadWriteClose },
674 ];
675 }
676 > hasCapability(resource: URI, capability: FileSystemProviderCapabilities): boolean { workbenchTestServices.ts
677 if (capability === FileSystemProviderCapabilities.PathCaseSensitive && isLinux) {
678 return true;
683 return !!(provider && (provider.capabilities & capability));
684 }
686 > async del(_resource: URI, _options?: { useTrash?: boolean; recursive?: boolean }): Promise<void> { }
687 >
688 > createWatcher(resource: URI, options: IWatchOptions): IFileSystemWatcher {
689 return {
690 onDidChange: Event.None,
692 };
693 }
695 >
696 > readonly watches: URI[] = [];
697 watch(_resource: URI, options: IWatchOptionsWithCorrelation): IFileSystemWatcher;
698 watch(_resource: URI): IDisposable;
717 */
718 export class InMemoryTestFileService extends TestFileService {
720 > private files = new ResourceMap<VSBuffer>();
721
722 override clearTracking(): void {