Skip to content

Commit

Permalink
coverage, dep update
Browse files Browse the repository at this point in the history
  • Loading branch information
scniro committed Apr 11, 2016
1 parent 6c2d924 commit aa0d7db
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ module.exports = function gulpAngularTpl2js(options) {
}

tpl2js.inline(buf, fileOptions || {}, function (err, result) {

if(err) {
done(err);
return;
}

done(null, new Buffer(result));
}, function (err) {
done(err)
});
});

Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gulp-angular-tpl2js",
"version": "0.0.3",
"version": "0.0.4",
"description": "Use gulp to convert Angular templates to inline JavaScript",
"files": [
"index.js"
Expand All @@ -17,10 +17,12 @@
"gulp": "^3.9.1",
"gulp-istanbul": "^0.10.4",
"gulp-mocha": "^2.2.0",
"mocha": "^2.4.5"
"mocha": "^2.4.5",
"vinyl": "^1.1.1",
"vinyl-fs-fake": "^1.1.0"
},
"dependencies": {
"angular-tpl2js": "0.0.6",
"angular-tpl2js": "0.0.8",
"gulp-util": "^3.0.7",
"object-assign": "^4.0.1",
"readable-stream": "^2.0.6",
Expand Down
19 changes: 19 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
var gulp = require('gulp');
var chai = require('chai');
var tpl2js = require('..');
var vfsFake = require('vinyl-fs-fake');
var File = require('vinyl');
var PluginError = require('gulp-util').PluginError;
var expect = chai.expect;

chai.should();
Expand Down Expand Up @@ -91,4 +94,20 @@ describe('gulp-angular-tpl2js: base functionality', function () {
done();
});
});

it('should force a plugin error', function (done) {

var js = new File({
path: '/',
contents: new Buffer('angular.module(\'mod\').directive(\'dir\', function () { return { scope: {}, templateUrl: \'fixtures/templates/404.html\', link: function (scope, elem, attrs) { } } });')
});

vfsFake.src(js)
.pipe(tpl2js())
.on('error', function (err) {
expect(err).to.exist;
expect(err).to.be.an.instanceof(PluginError);
done();
});
});
});

0 comments on commit aa0d7db

Please sign in to comment.