Skip to content

Commit d80313f

Browse files
committed
Suppress parse error in test
1 parent f5ea8a0 commit d80313f

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
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",

test/extract_javascript.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
var assert = require('assert');
4+
var sinon = require('sinon');
45
var testExtract = require('./utils').testExtract;
56

67
describe('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 () {

0 commit comments

Comments
 (0)