Skip to content

Commit 523eda9

Browse files
madhur310mshanemc
andauthored
ci: ci for the new lls (#6745)
* ci: wireit test/lint scripts * fix: fix unit tests * fix: windows ut * fix: use common normalize * fix: update snaps * fix: path * fix: revert some changes * fix: update snapshot * fix: revert seeming unnecessary changes * fix: remove unnecessary depend * fix: try old logic * fix: remove unnecessary awaits --------- Co-authored-by: mshanemc <shane.mclaughlin@salesforce.com>
1 parent 6617019 commit 523eda9

22 files changed

Lines changed: 842 additions & 363 deletions

File tree

package-lock.json

Lines changed: 202 additions & 144 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,10 @@
202202
"./packages/salesforcedx-vscode-services:lint",
203203
"./packages/salesforcedx-vscode-org:lint",
204204
"./packages/salesforcedx-vscode-org-browser:lint",
205-
"./packages/salesforcedx-vscode-automation-tests:lint"
205+
"./packages/salesforcedx-vscode-automation-tests:lint",
206+
"./packages/salesforcedx-lightning-lsp-common:lint",
207+
"./packages/salesforcedx-aura-language-server:lint",
208+
"./packages/salesforcedx-lwc-language-server:lint"
206209
]
207210
},
208211
"test": {
@@ -214,6 +217,9 @@
214217
"./packages/salesforcedx-sobjects-faux-generator:test",
215218
"./packages/salesforcedx-apex-debugger:test",
216219
"./packages/salesforcedx-apex-replay-debugger:test",
220+
"./packages/salesforcedx-lightning-lsp-common:test",
221+
"./packages/salesforcedx-aura-language-server:test",
222+
"./packages/salesforcedx-lwc-language-server:test",
217223
"./packages/salesforcedx-visualforce-markup-language-server:test",
218224
"./packages/salesforcedx-visualforce-language-server:test",
219225
"./packages/salesforcedx-vscode-core:test",

packages/salesforcedx-aura-language-server/package.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"scripts": {
3030
"clean": "shx rm -rf node_modules out coverage .wireit .eslintcache",
3131
"compile": "wireit",
32-
"test": "jest --coverage",
32+
"test": "wireit",
3333
"lint": "wireit"
3434
},
3535
"wireit": {
@@ -60,6 +60,18 @@
6060
"../../eslint.config.mjs"
6161
],
6262
"output": []
63+
},
64+
"test": {
65+
"command": "jest --coverage",
66+
"dependencies": [
67+
"compile"
68+
],
69+
"files": [
70+
"src/**/*.ts",
71+
"jest.config.js",
72+
"../../config/jest.base.config.js"
73+
],
74+
"output": []
6375
}
6476
},
6577
"dependencies": {

packages/salesforcedx-aura-language-server/src/aura-indexer/__tests__/__snapshots__/indexer.spec.ts.snap

Lines changed: 143 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`indexer parsing content aura indexer 1`] = `[]`;
3+
exports[`indexer parsing content aura indexer 1`] = `
4+
[
5+
"force-app/main/default/aura/helloWorldApp/helloWorldApp.app",
6+
"force-app/main/default/aura/indexApp/indexApp.app",
7+
"force-app/main/default/aura/lightningExamplesApp/lightningExamplesApp.app",
8+
"force-app/main/default/aura/todoApp/todoApp.app",
9+
"force-app/main/default/aura/wireLdsApp/wireLdsApp.app",
10+
"force-app/main/default/aura/wireLdsCmp/wireLdsCmp.cmp",
11+
]
12+
`;
413

514
exports[`indexer parsing content aura indexer 2`] = `
615
Map {
@@ -868,6 +877,138 @@ Map {
868877
"namespace": "aura",
869878
"type": "STANDARD",
870879
},
880+
"c:helloWorldApp" => {
881+
"attributes": [],
882+
"documentation": "",
883+
"file": "force-app/main/default/aura/helloWorldApp/helloWorldApp.app",
884+
"location": {
885+
"range": {
886+
"end": {
887+
"character": 19,
888+
"line": 5,
889+
},
890+
"start": {
891+
"character": 1,
892+
"line": 1,
893+
},
894+
},
895+
"uri": "force-app/main/default/aura/helloWorldApp/helloWorldApp.app",
896+
},
897+
"lwc": false,
898+
"name": "c:helloWorldApp",
899+
"namespace": "c",
900+
"type": "CUSTOM",
901+
},
902+
"c:indexApp" => {
903+
"attributes": [],
904+
"documentation": "",
905+
"file": "force-app/main/default/aura/indexApp/indexApp.app",
906+
"location": {
907+
"range": {
908+
"end": {
909+
"character": 37,
910+
"line": 1,
911+
},
912+
"start": {
913+
"character": 1,
914+
"line": 1,
915+
},
916+
},
917+
"uri": "force-app/main/default/aura/indexApp/indexApp.app",
918+
},
919+
"lwc": false,
920+
"name": "c:indexApp",
921+
"namespace": "c",
922+
"type": "CUSTOM",
923+
},
924+
"c:lightningExamplesApp" => {
925+
"attributes": [],
926+
"documentation": "",
927+
"file": "force-app/main/default/aura/lightningExamplesApp/lightningExamplesApp.app",
928+
"location": {
929+
"range": {
930+
"end": {
931+
"character": 37,
932+
"line": 1,
933+
},
934+
"start": {
935+
"character": 1,
936+
"line": 1,
937+
},
938+
},
939+
"uri": "force-app/main/default/aura/lightningExamplesApp/lightningExamplesApp.app",
940+
},
941+
"lwc": false,
942+
"name": "c:lightningExamplesApp",
943+
"namespace": "c",
944+
"type": "CUSTOM",
945+
},
946+
"c:todoApp" => {
947+
"attributes": [],
948+
"documentation": "",
949+
"file": "force-app/main/default/aura/todoApp/todoApp.app",
950+
"location": {
951+
"range": {
952+
"end": {
953+
"character": 19,
954+
"line": 6,
955+
},
956+
"start": {
957+
"character": 1,
958+
"line": 1,
959+
},
960+
},
961+
"uri": "force-app/main/default/aura/todoApp/todoApp.app",
962+
},
963+
"lwc": false,
964+
"name": "c:todoApp",
965+
"namespace": "c",
966+
"type": "CUSTOM",
967+
},
968+
"c:wireLdsApp" => {
969+
"attributes": [],
970+
"documentation": "",
971+
"file": "force-app/main/default/aura/wireLdsApp/wireLdsApp.app",
972+
"location": {
973+
"range": {
974+
"end": {
975+
"character": 37,
976+
"line": 1,
977+
},
978+
"start": {
979+
"character": 1,
980+
"line": 1,
981+
},
982+
},
983+
"uri": "force-app/main/default/aura/wireLdsApp/wireLdsApp.app",
984+
},
985+
"lwc": false,
986+
"name": "c:wireLdsApp",
987+
"namespace": "c",
988+
"type": "CUSTOM",
989+
},
990+
"c:wireLdsCmp" => {
991+
"attributes": [],
992+
"documentation": "",
993+
"file": "force-app/main/default/aura/wireLdsCmp/wireLdsCmp.cmp",
994+
"location": {
995+
"range": {
996+
"end": {
997+
"character": 17,
998+
"line": 3,
999+
},
1000+
"start": {
1001+
"character": 1,
1002+
"line": 1,
1003+
},
1004+
},
1005+
"uri": "force-app/main/default/aura/wireLdsCmp/wireLdsCmp.cmp",
1006+
},
1007+
"lwc": false,
1008+
"name": "c:wireLdsCmp",
1009+
"namespace": "c",
1010+
"type": "CUSTOM",
1011+
},
8711012
"clients:availableForMailAppAppPage" => {
8721013
"attributes": [],
8731014
"documentation": "Marker Interface that allows components to show up in the Lightning for Gmail or Lightning For Outlook Flexipages",
@@ -14619,6 +14760,7 @@ Map {
1461914760
exports[`indexer parsing content aura indexer 3`] = `
1462014761
[
1462114762
"aura",
14763+
"c",
1462214764
"clients",
1462314765
"flexipage",
1462414766
"force",

packages/salesforcedx-aura-language-server/src/aura-indexer/__tests__/indexer.spec.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,19 @@ jest.mock('../../resources/transformed-aura-system.json', () =>
7272
mockJsonFromAuraServer('resources/transformed-aura-system.json')
7373
);
7474

75-
import { FileSystemDataProvider } from '@salesforce/salesforcedx-lightning-lsp-common';
75+
import { FileSystemDataProvider, normalizePath } from '@salesforce/salesforcedx-lightning-lsp-common';
7676
import { SFDX_WORKSPACE_ROOT, sfdxFileSystemProvider } from '@salesforce/salesforcedx-lightning-lsp-common/testUtils';
7777
import * as path from 'node:path';
7878
import URI from 'vscode-uri';
7979
import { AuraWorkspaceContext } from '../../context/auraContext';
8080
import AuraIndexer from '../indexer';
8181

8282
// Normalize paths for cross-platform test consistency
83+
// Converts absolute paths to relative paths from the workspace root
8384
const normalize = (start: string, p: string): string => {
84-
// Convert backslashes to forward slashes and normalize to POSIX format
85-
const normalizedStart = path.posix.normalize(start.replaceAll('\\', '/'));
86-
const normalizedP = path.posix.normalize(p.replaceAll('\\', '/'));
85+
const normalizedStart = normalizePath(start);
86+
const normalizedP = normalizePath(p);
8787

88-
// Handle Windows case-insensitive paths by comparing lowercase
8988
if (normalizedP.toLowerCase().startsWith(normalizedStart.toLowerCase())) {
9089
return path.posix.relative(normalizedStart, normalizedP);
9190
}
@@ -96,16 +95,15 @@ const uriToFile = (uri: string): string => URI.parse(uri).fsPath;
9695

9796
describe('indexer parsing content', () => {
9897
it('aura indexer', async () => {
99-
const context = new AuraWorkspaceContext(SFDX_WORKSPACE_ROOT, new FileSystemDataProvider());
98+
const context = new AuraWorkspaceContext(SFDX_WORKSPACE_ROOT, sfdxFileSystemProvider);
10099
context.initialize('SFDX');
101-
await context.configureProject();
100+
context.configureProject();
102101

103102
const auraIndexer = new AuraIndexer(context);
104103
await auraIndexer.configureAndIndex();
105104
context.addIndexingProvider({ name: 'aura', indexer: auraIndexer });
106105

107-
let markup = await context.findAllAuraMarkup();
108-
markup = markup.map(p => normalize(SFDX_WORKSPACE_ROOT, p)).toSorted();
106+
const markup = (await context.findAllAuraMarkup()).map(p => normalize(SFDX_WORKSPACE_ROOT, p)).toSorted();
109107
expect(markup).toMatchSnapshot();
110108
const tags = auraIndexer.getAuraTags();
111109
tags.forEach(taginfo => {
@@ -134,7 +132,7 @@ describe('indexer parsing content', () => {
134132
it('should index a valid aura component', async () => {
135133
const context = new AuraWorkspaceContext(SFDX_WORKSPACE_ROOT, sfdxFileSystemProvider);
136134
context.initialize('SFDX');
137-
await context.configureProject();
135+
context.configureProject();
138136
const auraIndexer = new AuraIndexer(context);
139137
await auraIndexer.configureAndIndex();
140138
context.addIndexingProvider({ name: 'aura', indexer: auraIndexer });
@@ -155,7 +153,7 @@ describe('indexer parsing content', () => {
155153
xit('should handle indexing an invalid aura component', async () => {
156154
const context = new AuraWorkspaceContext(SFDX_WORKSPACE_ROOT, new FileSystemDataProvider());
157155
context.initialize('SFDX');
158-
await context.configureProject();
156+
context.configureProject();
159157
const auraIndexer = new AuraIndexer(context);
160158
await auraIndexer.configureAndIndex();
161159
context.addIndexingProvider({ name: 'aura', indexer: auraIndexer });

packages/salesforcedx-aura-language-server/src/aura-indexer/indexer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export default class AuraIndexer implements Indexer {
142142

143143
for (const file of markupfiles) {
144144
try {
145-
await this.indexFile(file, this.context.type === 'SFDX');
145+
this.indexFile(file, this.context.type === 'SFDX');
146146
} catch (e) {
147147
Logger.log(`Error parsing markup from ${file}:`, e);
148148
}
@@ -283,7 +283,7 @@ export default class AuraIndexer implements Indexer {
283283
if (!str) {
284284
return '';
285285
}
286-
return str.replace(/"([^"]+(?="))"/g, '$1');
286+
return str.replaceAll(/"([^"]+(?="))"/g, '$1');
287287
}
288288

289289
private getTagInfo(file: string, sfdxProject: boolean, contents: string, node: Node): TagInfo | undefined {

packages/salesforcedx-aura-language-server/src/context/auraContext.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import {
1111
AURA_EXTENSIONS,
1212
findNamespaceRoots,
1313
Logger,
14-
normalizePath
14+
normalizePath,
15+
NormalizedPath
1516
} from '@salesforce/salesforcedx-lightning-lsp-common';
1617
import * as path from 'node:path';
1718
import { TextDocument } from 'vscode-languageserver-textdocument';
@@ -104,12 +105,12 @@ export class AuraWorkspaceContext extends BaseWorkspaceContext {
104105
return roots;
105106
}
106107

107-
public async findAllAuraMarkup(): Promise<string[]> {
108-
const files: string[] = [];
108+
public async findAllAuraMarkup(): Promise<NormalizedPath[]> {
109+
const files: NormalizedPath[] = [];
109110
const namespaceRoots = await this.findNamespaceRootsUsingTypeCache();
110111

111112
for (const namespaceRoot of namespaceRoots.aura) {
112-
const markupFiles = await findAuraMarkupIn(namespaceRoot, this);
113+
const markupFiles = findAuraMarkupIn(namespaceRoot, this);
113114
files.push(...markupFiles);
114115
}
115116
return files;
@@ -128,8 +129,8 @@ export class AuraWorkspaceContext extends BaseWorkspaceContext {
128129
}
129130
}
130131

131-
const findAuraMarkupIn = async (namespaceRoot: string, context: AuraWorkspaceContext): Promise<string[]> => {
132-
const files: string[] = [];
132+
const findAuraMarkupIn = (namespaceRoot: string, context: AuraWorkspaceContext): NormalizedPath[] => {
133+
const files: NormalizedPath[] = [];
133134

134135
try {
135136
const dirs = context.fileSystemProvider.getDirectoryListing(normalizePath(namespaceRoot));
@@ -140,9 +141,9 @@ const findAuraMarkupIn = async (namespaceRoot: string, context: AuraWorkspaceCon
140141

141142
if (isDir) {
142143
for (const ext of AURA_EXTENSIONS) {
143-
const markupFile = normalizePath(path.join(componentDir, dir.name + ext));
144-
const exists = context.fileSystemProvider.fileExists(markupFile);
145-
if (exists) {
144+
// Construct path using namespaceRoot and dir.name to preserve original casing
145+
const markupFile = normalizePath(path.join(namespaceRoot, dir.name, dir.name + ext));
146+
if (context.fileSystemProvider.fileExists(markupFile)) {
146147
files.push(markupFile);
147148
}
148149
}

packages/salesforcedx-aura-language-server/src/tern-server/__tests__/ternCompletion.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ jest.mock('../../tern/defs/ecmascript.json', () => createMockJsonFromTernDefs('e
4141

4242
// These imports are needed for the mock factory function and are hoisted, so import order doesn't matter
4343

44-
import { FileSystemDataProvider } from '@salesforce/salesforcedx-lightning-lsp-common';
45-
4644
import { SFDX_WORKSPACE_ROOT, sfdxFileSystemProvider } from '@salesforce/salesforcedx-lightning-lsp-common/testUtils';
4745
import { AuraWorkspaceContext } from '../../context/auraContext';
4846
import { onCompletion, onHover, onDefinition, onReferences } from '../ternServer';
@@ -52,7 +50,7 @@ const LIGHTNING_EXAMPLES_APP_PATH = `${SFDX_WORKSPACE_ROOT}/force-app/main/defau
5250
describe('tern completion', () => {
5351
it('tern completions', async () => {
5452
const ws = SFDX_WORKSPACE_ROOT;
55-
const context = new AuraWorkspaceContext(ws, new FileSystemDataProvider());
53+
const context = new AuraWorkspaceContext(ws, sfdxFileSystemProvider);
5654
context.initialize('SFDX');
5755
context.configureProject();
5856

packages/salesforcedx-aura-language-server/src/tern-server/ternAura.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ const forAllPropsPurgeable = infer.constraint({
4242
}
4343
});
4444

45-
const getFilename = (filename: string): string => {
46-
return path.join(server.options.projectDir, filename);
47-
};
45+
const getFilename = (filename: string): string => path.join(server.options.projectDir, filename);
4846

4947
const isBlocklisted = (filename: string): boolean => {
5048
// Normalize path separators for cross-platform compatibility
@@ -73,9 +71,9 @@ const readFile = async (filename: string): Promise<string> => {
7371
}
7472
};
7573

76-
const trimExt = (path: string): string => {
77-
const lastDot = path.lastIndexOf('.');
78-
return lastDot === -1 ? path : path.slice(0, lastDot);
74+
const trimExt = (input: string): string => {
75+
const lastDot = input.lastIndexOf('.');
76+
return lastDot === -1 ? input : input.slice(0, lastDot);
7977
};
8078

8179
const initScope = (scope: any): void => {

0 commit comments

Comments
 (0)