Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TwitchBronBron committed Nov 1, 2024
1 parent 7c4688b commit 67fd120
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/LanguageServer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@ describe('LanguageServer', () => {
expect(
filterer.filter([
s`${workspacePath}/src/source/file.brs`,
//this file should be excluded
s`${workspacePath}/dist/source/file.brs`
])
).to.eql([
Expand Down
4 changes: 3 additions & 1 deletion src/lsp/PathFilterer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class PathFilterer {

const collection = new PathCollection({
matcher: matcher,
isExcludePattern: true
isExcludePattern: false
});
this.excludeCollections.push(collection);
return () => {
Expand Down Expand Up @@ -184,6 +184,7 @@ export class PathCollection {
glob
).replace(/\\+/g, '/');
this.matchers.push({
pattern: pattern,
isMatch: micromatch.matcher(pattern),
isExcludePattern: isExcludePattern
});
Expand All @@ -197,6 +198,7 @@ export class PathCollection {
}

private matchers: Array<{
pattern?: string;
isMatch: (string) => boolean;
isExcludePattern: boolean;
}> = [];
Expand Down
8 changes: 5 additions & 3 deletions src/lsp/ProjectManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ describe('ProjectManager', () => {
await onNextDiagnostics();

//there should NOT be a standalone project
expect(manager['standaloneProjects'].length).to.eql(0);
expect(manager['standaloneProjects'].size).to.eql(0);
});

it('converts a missing file to a delete', async () => {
Expand Down Expand Up @@ -740,13 +740,15 @@ describe('ProjectManager', () => {
allowStandaloneProject: true
}]);
await onNextDiagnostics();
expect(manager['standaloneProjects'][0]?.srcPath).to.eql(s`${rootDir}/source/main.brs`);
expect(
[...manager['standaloneProjects'].values()][0]?.srcPath
).to.eql(s`${rootDir}/source/main.brs`);

//it deletes the standalone project when the file is closed
await manager.handleFileClose({
srcPath: `${rootDir}/source/main.brs`
});
expect(manager['standaloneProjects']).to.be.empty;
expect(manager['standaloneProjects'].size).to.eql(0);
});
});
});

0 comments on commit 67fd120

Please sign in to comment.