File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -179,6 +179,16 @@ var Extractor = (function () {
179179 }
180180 } ) ;
181181 } catch ( err ) {
182+ var errMsg = 'Error parsing' ;
183+ if ( filename ) {
184+ errMsg += ' ' + filename ;
185+ }
186+ if ( err . lineNumber ) {
187+ errMsg += ' at line ' + err . lineNumber ;
188+ errMsg += ' column ' + err . column ;
189+ }
190+
191+ console . warn ( errMsg ) ;
182192 return ;
183193 }
184194
Original file line number Diff line number Diff line change 3030 "grunt-contrib-jshint" : " ~0.11.2" ,
3131 "grunt-contrib-watch" : " ~0.6.1" ,
3232 "grunt-jscs" : " ^1.8.0" ,
33- "grunt-mocha-cli" : " ^1.13.1"
33+ "grunt-mocha-cli" : " ^1.13.1" ,
34+ "sinon" : " ^1.17.4"
3435 },
3536 "keywords" : [
3637 " angular" ,
Original file line number Diff line number Diff line change 11'use strict' ;
22
33var assert = require ( 'assert' ) ;
4+ var sinon = require ( 'sinon' ) ;
45var testExtract = require ( './utils' ) . testExtract ;
56
67describe ( 'Extracting from Javascript' , function ( ) {
@@ -78,11 +79,23 @@ describe('Extracting from Javascript', function () {
7879 assert . deepEqual ( catalog . items [ 1 ] . references , [ 'test/fixtures/deeppath_catalog.js:4' ] ) ;
7980 } ) ;
8081
81- it ( 'supports invalid javascript syntax without exception' , function ( ) {
82- var files = [
83- 'test/fixtures/deeppath_catalog_invalid.js'
84- ] ;
85- testExtract ( files ) ;
82+ describe ( 'invalid javascript' , function ( ) {
83+ beforeEach ( function ( ) {
84+ sinon . stub ( console , 'warn' , function ( ) {
85+ // respect the rule of silence
86+ } ) ;
87+ } ) ;
88+
89+ afterEach ( function ( ) {
90+ console . warn . restore ( ) ;
91+ } ) ;
92+
93+ it ( 'should not throw an exception' , function ( ) {
94+ var files = [
95+ 'test/fixtures/deeppath_catalog_invalid.js'
96+ ] ;
97+ testExtract ( files ) ;
98+ } ) ;
8699 } ) ;
87100
88101 describe ( 'from HTML <script> tags' , function ( ) {
You can’t perform that action at this time.
0 commit comments