File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1630,8 +1630,9 @@ export class AngularDependencies extends FrameworkDependencies {
16301630 let description : string = '' ;
16311631 if ( node . jsDoc ) {
16321632 if ( node . jsDoc . length > 0 ) {
1633- if ( typeof node . jsDoc [ 0 ] . comment !== 'undefined' ) {
1634- const rawDescription = this . jsdocParserUtil . parseJSDocNode ( node . jsDoc [ 0 ] ) ;
1633+ const lastJsDoc = node . jsDoc [ node . jsDoc . length - 1 ] ;
1634+ if ( typeof lastJsDoc . comment !== 'undefined' ) {
1635+ const rawDescription = this . jsdocParserUtil . parseJSDocNode ( lastJsDoc ) ;
16351636 description = markedAcl ( rawDescription ) ;
16361637 }
16371638 }
Original file line number Diff line number Diff line change 1+ /**
2+ * @license
3+ * @copyright
4+ */
5+
6+ /**
7+ * Does the thing.
8+ * @param a thing.
9+ * @param b thing.
10+ * @returns A thing.
11+ */
12+ export function exampleFn (
13+ a : string ,
14+ b : string ,
15+ ) : unknown {
16+ return null ;
17+ }
Original file line number Diff line number Diff line change 1+ {
2+ "compilerOptions" : {
3+ "module" : " commonjs"
4+ },
5+ "include" : [
6+ " foo-with-license-header.function.ts"
7+ ]
8+ }
Original file line number Diff line number Diff line change @@ -460,4 +460,33 @@ describe('CLI coverage report', () => {
460460 ) ;
461461 } ) ;
462462 } ) ;
463+
464+ describe ( 'coverage regression - @license/@copyright header should not shadow function JSDoc' , ( ) => {
465+ let stdoutString = undefined ;
466+ before ( function ( done ) {
467+ tmp . create ( distFolder ) ;
468+ let ls = shell ( 'node' , [
469+ './bin/index-cli.js' ,
470+ '-p' ,
471+ './test/fixtures/sample-files/tsconfig.license-header.json' ,
472+ '--coverageMinimumPerFile' ,
473+ '100' ,
474+ '--coverageTestShowOnlyFailed' ,
475+ '-d' ,
476+ distFolder
477+ ] ) ;
478+
479+ if ( ls . stderr . toString ( ) !== '' ) {
480+ console . error ( `shell error: ${ ls . stderr . toString ( ) } ` ) ;
481+ done ( 'error' ) ;
482+ }
483+ stdoutString = ls . stdout . toString ( ) ;
484+ done ( ) ;
485+ } ) ;
486+ after ( ( ) => tmp . clean ( distFolder ) ) ;
487+
488+ it ( 'should report 100% coverage for a documented function preceded by a @license/@copyright header' , ( ) => {
489+ expect ( stdoutString ) . to . not . contain ( 'under minimum per file' ) ;
490+ } ) ;
491+ } ) ;
463492} ) ;
You can’t perform that action at this time.
0 commit comments