diff --git a/src/js/extractors/comments.ts b/src/js/extractors/comments.ts index 86263db..1e11889 100644 --- a/src/js/extractors/comments.ts +++ b/src/js/extractors/comments.ts @@ -72,6 +72,7 @@ export abstract class JsCommentUtils { case ts.SyntaxKind.ThrowStatement: case ts.SyntaxKind.ExpressionStatement: case ts.SyntaxKind.ParenthesizedExpression: + case ts.SyntaxKind.BinaryExpression: return this.getExtractionPositions(node.parent, sourceFile); case ts.SyntaxKind.VariableDeclaration: diff --git a/tests/js/extractors/comments.test.ts b/tests/js/extractors/comments.test.ts index 3dd910a..4ce8074 100644 --- a/tests/js/extractors/comments.test.ts +++ b/tests/js/extractors/comments.test.ts @@ -214,7 +214,7 @@ describe('JS: comments', () => { }); }); - describe('variable assignment', () => { + describe('variable declaration', () => { test('single variable', () => { check(` @@ -353,6 +353,16 @@ describe('JS: comments', () => { }); }); + test('variable assignment', () => { + check(` + // Relevant leading line comment + foo = getText('Foo'); // Relevant trailing line comment + `, { + otherLineLeading: ['Relevant leading line comment'], + sameLineTrailing: ['Relevant trailing line comment'] + }); + }); + describe('object literal', () => { describe('single line', () => {