diff --git a/packages/lwc-language-server/src/javascript/__tests__/compiler.test.ts b/packages/lwc-language-server/src/javascript/__tests__/compiler.test.ts index 595cc1cf..eb1c1a3f 100644 --- a/packages/lwc-language-server/src/javascript/__tests__/compiler.test.ts +++ b/packages/lwc-language-server/src/javascript/__tests__/compiler.test.ts @@ -103,7 +103,7 @@ it('linter returns empty diagnostics on correct file', async () => { expect(diagnostics).toEqual([]); }); -it('transform returns javascript metadata', async () => { +it('mapLwcMetadataToInternal returns expected javascript metadata', async () => { const filepath = path.join('src', 'javascript', '__tests__', 'fixtures', 'metadata.js'); const content = fs.readFileSync(filepath, 'utf8'); @@ -120,8 +120,6 @@ it('transform returns javascript metadata', async () => { const modernMetadata = collectBundleMetadata(options); const metadata = mapLwcMetadataToInternal(modernMetadata.files[0] as ScriptFile); - - // TODO: see if the rest of this works as expected const properties = getProperties(metadata); expect(metadata.doc).toBe('* Foo doc'); diff --git a/packages/lwc-language-server/src/javascript/__tests__/type-mapping.test.ts b/packages/lwc-language-server/src/javascript/__tests__/type-mapping.test.ts index ac912b9e..36ab1452 100644 --- a/packages/lwc-language-server/src/javascript/__tests__/type-mapping.test.ts +++ b/packages/lwc-language-server/src/javascript/__tests__/type-mapping.test.ts @@ -10,7 +10,6 @@ it('can map new metadata to old metadata', async () => { const filepath = path.join('src', 'javascript', '__tests__', 'fixtures', 'metadata.js'); const content = fs.readFileSync(filepath, 'utf8'); - // Work with new metadata. const newMetadataOpts: BundleConfig = { type: 'internal', name: 'metadata', diff --git a/packages/lwc-language-server/src/javascript/compiler.ts b/packages/lwc-language-server/src/javascript/compiler.ts index 2a4ef3a4..de1e7dda 100644 --- a/packages/lwc-language-server/src/javascript/compiler.ts +++ b/packages/lwc-language-server/src/javascript/compiler.ts @@ -123,11 +123,6 @@ function toDiagnostic(err: any): Diagnostic { }; } -function externalToInternalDiagnostic(ext: CompilerDiagnostic[]): Diagnostic[] { - // TODO: do this for real - return ext as unknown as Diagnostic[]; -} - export async function compileSource(source: string, fileName = 'foo.js'): Promise { const name = fileName.substring(0, fileName.lastIndexOf('.')); @@ -142,7 +137,6 @@ export async function compileSource(source: string, fileName = 'foo.js'): Promis diagnostics: [toDiagnostic(err)], }; } - // TODO: should we do something with transformSync(...).warnings? const options: BundleConfig = { type: 'platform', @@ -158,7 +152,9 @@ export async function compileSource(source: string, fileName = 'foo.js'): Promis }; const modernMetadata = collectBundleMetadata(options); if (modernMetadata?.diagnostics.length) { - return { diagnostics: externalToInternalDiagnostic(modernMetadata.diagnostics) }; + return { + diagnostics: modernMetadata.diagnostics.map(toDiagnostic), + }; } const metadata = mapLwcMetadataToInternal(modernMetadata.files[0] as ScriptFile);